2016-11-22 56 views

回答

2

解决您的问题的解决方案是在类加载方法中注册UIApplicationDidFinishLaunchingNotification。例如。

+ (void)load { 
    NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter]; 
    [defaultCenter addObserver:self 
         selector:@selector(appDidLaunch) 
          name:UIApplicationDidFinishLaunchingNotification 
         object:nil]; 
} 

+ (void)appDidLaunch:(NSNotification *)notification { 
    NSDictionary *options = [notification userInfo]; 
    // Your code here 
} 
+0

谢谢。我可以使用这种方法来实现ios推送通知吗?教程建议它必须在AppDelegate文件中实现 – Jibus

相关问题