Static Method Access in GDB

I recently discovered GDB in Xcode, which makes up for some of the functionality that IMHO seems to lack in Xcode.

Therefore, I can do the following in GDB:

(gdb) po [LoginManager sharedSession].loginToken 20D52FE9-3573-437E-9A65-846572B63726 

However, I have another Service class that is not currently loaded, so I get the following error:

 (gdb) po [SessionService displaySessionInfoForToken:@"XXX"] No symbol "SessionService" in current context. 

I do not understand why loading LoginManager , but not SessionService .

+3
source share
1 answer

Try using NSClassFromString, for example:

 (gdb) po [NSClassFromString(@"SessionService") displaySessionInfoForToken:@"XXX"] 

It's hard to tell what is happening, but using NSClassFromString can tickle the right thing at runtime to do what you want.

+5
source

All Articles