2017-01-05 1 views
0

после этого promising tutorial от nickjf89 Я пытаюсь реализовать Push Notification в проекте Vanilla Cordova.Выполнение PUSER APNs Уведомление

До сих пор я могу получить связь с сокетом, когда я нажимаю данные с консоли Pusher, все работает, поэтому я исключаю любую неверную конфигурацию для API-интерфейса Pusher.

«Единственная» вещь, которая терпит неудачу, является фактическим Push Notification. Глядя на консоль Push Notification, я вижу, что мой запрос поступает на мой канал cordova. Но в консоли xCode я не вижу ожидаемого журнала от NSLog(@"Received remote notification: %@", userInfo);

Я подозреваю, что у меня есть проблема с моим AppDelegate.m, который находится ниже.

#import "AppDelegate.h" 
#import "MainViewController.h" 

@import UserNotifications; 
#import <PusherSwift/PusherSwift-Swift.h> 

@interface AppDelegate() 
@property (nonatomic, retain, readwrite) Pusher *pusher; 

@end 

@implementation AppDelegate 


- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions 
{ 
    self.viewController = [[MainViewController alloc] init]; 

    self.pusher = [[Pusher alloc] initWithKey:@"here_i_put_my_pusher_app_key"]; 

    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; 

    [center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionAlert | UNAuthorizationOptionSound) completionHandler:^(BOOL granted, NSError * _Nullable error) { 
     // Enable or disable features based on authorisation. 
    }]; 

    [application registerForRemoteNotifications]; 

    return [super application:application didFinishLaunchingWithOptions:launchOptions]; 
} 

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 
    NSLog(@"Registered for remote notifications; received device token"); 
    [[[self pusher] nativePusher] registerWithDeviceToken:deviceToken]; 
    [[[self pusher] nativePusher] subscribeWithInterestName:@"cordova"]; 
    NSLog(@"Seeems token stuff works"); 
} 

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { 
    NSLog(@"Received remote notification: %@", userInfo); 
} 

@end 

ответ

0

Хорошо, снова один раз, вопрос был между стулом и клавиатурой ... я нашел исправить, это было связано с сертификатом APN, закачанный на толкателя и где среде APS my-app-name.entitlements был установлен вместо развития.

Все исправлены и функциональны, отличная новая функция от Pusher!