Im utilizzando le seguenti righe di codice per ottenere gettone per notifica push,Token Per pushnotification iOS 8 vs iOS7 PhoneGap
ho aggiunto prossime righe per supportate in iOS 8, ma quando si aggiungono queste righe l'IPA funziona su iOS 8, ma non su iOS7 su iOS7 l'applicazione viene chiusa immediatamente dopo l'apertura.
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
#ifdef __IPHONE_8_0
//Right, that is the point
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge
|UIRemoteNotificationTypeSound
|UIRemoteNotificationTypeAlert) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
#else
//register to receive notifications
UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:myTypes];
#endif
#ifdef __IPHONE_8_0
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
//register to receive notifications
[application registerForRemoteNotifications];
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler
{
//handle the actions
if ([identifier isEqualToString:@"declineAction"]){
}
else if ([identifier isEqualToString:@"answerAction"]){
}
}
#endif
Qual è l'eccezione che si vede quando si esegue l'applicazione su iOS 7? – ebi
registerUserNotificationSettings:]: selettore non riconosciuto rinviati esempio 0x16d71c60 2014/10/31 12: 56: 00,899 ClickMobileCDV [1875 60b] *** terminazione app causa eccezione non identificata 'NSInvalidArgumentException', motivo: '- [registerUserNotificationSettings UIApplication:] : selettore non riconosciuto inviato all'istanza 0x16d71c60 ' *** Primo stack di chiamate throw: –