PhoneGap / iOS LocalNotification App Crashes on tapping “View”

后端 未结 4 425
孤城傲影
孤城傲影 2021-01-02 20:46

I\'m having trouble here: I have the app set to not run in the background, and I\'m setting a dailyInterval localnotification using a localNotification plugin I found on git

4条回答
  •  盖世英雄少女心
    2021-01-02 21:26

    OK, I found the problem, it's in the file AppDelegate.m and more precisely in the method : didFinishLaunchingWithOptions. The method assumes that the first option parameters is an url (but it's not when we launch the app via a Local Notification. The quick and dirty fix is to comment the code :

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        //commented out because it makes the app crash at startup with local notification...
        /*NSArray *keyArray = [launchOptions allKeys];
        if ([launchOptions objectForKey:[keyArray objectAtIndex:0]]!=nil) 
        {
            NSURL *url = [launchOptions objectForKey:[keyArray objectAtIndex:0]];
            self.invokeString = [url absoluteString];
            NSLog(@"Mosa_fr_en-busi launchOptions = %@",url);
        }*/
    
        return [super application:application didFinishLaunchingWithOptions:launchOptions];
    }
    

提交回复
热议问题