0

我已经在 iPhone 中使用城市飞艇(开发)实现了推送通知。

它工作正常。我想在新设备上进行测试。我从新的 mac PC 在新设备中安装了相同的项目我还在钥匙串中添加了证书并运行,但日志显示设备令牌为空,并且城市仪表板中没有新的设备令牌。

空设备令牌的原因是什么?有什么遗漏吗?我应该对 .p12 文件做些什么吗?

我在 didFinishLaunchingWithOptions 中有这个:

// Get the results out to open or close notification
    bool storedresult =  [defaults boolForKey:airShipKey];

    if(storedresult){
        [UAPush shared].pushEnabled=YES;
    }else{
        [UAPush shared].pushEnabled=NO;
    }


    // Override point for customization after application launch.
    //Create Airship options directory and add the required UIApplication launchOptions
    NSMutableDictionary *takeOffOptions = [NSMutableDictionary dictionary];
    [takeOffOptions setValue:launchOptions forKey:UAirshipTakeOffOptionsLaunchOptionsKey];

    // Call takeOff (which creates the UAirship singleton), passing in the launch options so the
    // library can properly record when the app i launched from a push notification. This call is
    // required.
    //
    // Populate AirshipConfig.plist with your app's info from https://go.urbanairship.com
    [UAirship takeOff:takeOffOptions];

    // Set the icon badge to zero on startup (optional)
    [[UAPush shared] resetBadge];



    [[UAPush shared]
     registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
                                         UIRemoteNotificationTypeSound |
                                         UIRemoteNotificationTypeAlert)];

    // Handle any incoming incoming push notifications.
    // This will invoke `handleBackgroundNotification` on your UAPushNotificationDelegate.
    [[UAPush shared] handleNotification:[launchOptions valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]
                       applicationState:application.applicationState];

这是 didRegisterForRemoteNotificationsWithDeviceToken

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {


    UA_LINFO(@"APNS device token: %@", deviceToken);
    // Updates the device token and registers the token with UA.
    [[UAPush shared] registerDeviceToken:deviceToken];

}

我希望你能帮帮我

4

1 回答 1

0

你在哪里看到null价值?在 Urban Airship 仪表板中,或在方法中

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDeviceToken

于 2013-07-11T01:40:53.147 回答