2016-11-22 65 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

相關問題