转储头的访问实例变量(iOS)
我想知道“_lastNotificationReceivedBundleIdentifier”的值,它是一个类的实例变量。标题从iOS springboard应用程序中转储转储头的访问实例变量(iOS),ios,theos,Ios,Theos,我想知道“_lastNotificationReceivedBundleIdentifier”的值,它是一个类的实例变量。标题从iOS springboard应用程序中转储 @interface SBRemoteNotificationServer : NSObject <APSConnectionDelegate> { NSMutableDictionary* _bundleIdentifiersToClients; NSMutableDictionary* _en
@interface SBRemoteNotificationServer : NSObject <APSConnectionDelegate> {
NSMutableDictionary* _bundleIdentifiersToClients;
NSMutableDictionary* _environmentsToConnections;
unsigned _lastPlayedAlertSound;
NSString* _lastNotificationReceivedBundleIdentifier;
}
编译器错误是:
error: ‘_lastNotificationReceivedBundleIdentifier’ was not declared in this scope
如何访问和记录此NSString?您可能可以使用objective-c运行时功能,并查看方法
对象\u getInstanceVariable(对象,“\u lastNotificationReceivedBundleIdentifier”,(void**)和指针)代码>另一个要尝试的解决方案是:
[self valueForKey:@"lastNotificationReceivedBundleIdentifier"];
其中,self
是父对象,lastNotificationReceivedBundleIdentifier
是变量名。例如与self.lastNotificationReceivedBundleIdentifier
相同,谢谢。方法对象getInstanceVariable工作:-(void)noteApplicationFinishedLaunching:(id)启动{NSString*str;对象getInstanceVariable(self,“\u lastNotificationReceivedBundleIdentifier”,(void**)&str);NSLog(@“identifier=%@”,str);%orig;
Yay!您可以将我的答案标记为正确,以便将来如果有人正在搜索相同的问题,他将知道在哪里查看。
[self valueForKey:@"lastNotificationReceivedBundleIdentifier"];