Привет, я хотел реализовать службу уведомлений snspush, предоставляемую amazone. установить стручок для этого В podfile я пишу POD «AWSSNS» после этого стручка установитьAWSSNS (уведомление Amazone Push), авария приложения
Тогда я реализую код, как это
Когда я запускаю приложение, Существует аварии с последующим журналом
**** Завершение приложения из-за неперехваченного исключения «NSInternalInconsistencyException», причина: «Конфигурация службы: nil
. Вам нужно настроить Info.plist
или установить defaultServiceConfiguration
перед использованием этого метода. *
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIMutableUserNotificationCategory *messageCategory = [[UIMutableUserNotificationCategory alloc] init];
messageCategory.identifier = @"ShareAction";
UIMutableUserNotificationAction *notificationAction = [[UIMutableUserNotificationAction alloc] init];
notificationAction.identifier = @"ShareAction";
notificationAction.title = @"Share";
notificationAction.activationMode = UIUserNotificationActivationModeForeground;
notificationAction.authenticationRequired = YES;
notificationAction.destructive = NO;
[messageCategory setActions:@[notificationAction] forContext:UIUserNotificationActionContextDefault];
NSSet *categories = [NSSet setWithObject:messageCategory];
UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
UIUserNotificationSettings *mySettings = [UIUserNotificationSettings settingsForTypes:types categories:categories];
[[UIApplication sharedApplication] registerForRemoteNotifications];
[[UIApplication sharedApplication] registerUserNotificationSettings:mySettings];
}
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken{
NSString *deviceTokenString = [[[deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]] stringByReplacingOccurrencesOfString:@" " withString:@""];
NSLog(@"deviceTokenString: %@", deviceTokenString);
[[NSUserDefaults standardUserDefaults] setObject:deviceTokenString forKey:@"deviceToken"];
[[NSUserDefaults standardUserDefaults] synchronize];
AWSSNS *sns = [AWSSNS defaultSNS];
AWSSNSCreatePlatformEndpointInput *request = [AWSSNSCreatePlatformEndpointInput new];
request.token = deviceTokenString;
request.platformApplicationArn = SNSPlatformApplicationArn;
[[sns createPlatformEndpoint:request] continueWithBlock:^id(AWSTask *task) {
if (task.error != nil) {
NSLog(@"Error: %@",task.error);
} else {
AWSSNSCreateEndpointResponse *createEndPointResponse = task.result;
NSLog(@"endpointArn: %@",createEndPointResponse);
[[NSUserDefaults standardUserDefaults] setObject:createEndPointResponse.endpointArn forKey:@"endpointArn"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
return nil;
}];
}
Пожалуйста, помогите, если кто знает.
Его же, печать журнала, как Нагрузочный приложение из-за неперехваченного исключением «NSInternalInconsistencyException», причина: «Конфигурация службы равна нулю. Перед использованием этого метода вам необходимо настроить Info.plist или установить defaultServiceConfiguration. ' – user2856484