0

デバイストークンがないのはなぜですか?

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary      *)launchOptions {

 //Create Airship options dictionary 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 is 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];

// Register for remote notfications with the UA Library. This call is required.
[[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];



  2013-03-19 04:22:44.202 MyApp[1070:907] [D] -[UAPush applicationDidBecomeActive] [Line 555]        Checking registration status after foreground notification
  2013-03-19 04:22:44.204 MyApp[1070:907] [D] -[UAPush applicationDidBecomeActive] [Line 561]           Checking registration on app foreground disabled on app initialization
  2013-03-19 04:22:44.241 MyApp[1070:907] [D] -[UAUser listenForDeviceTokenReg] [Line 931]   ListenForDeviceTokenReg
  2013-03-19 04:22:44.270 MyApp[1070:907] [D] -[UAUser userCreated:] [Line 467] User created:   201:{"username": null, "alias": null, "tags": [], "user_id": "xK4v5lARRDCAvekt25TeqA",   "user_url": "https://device-api.urbanairship.com/api/user/xK4v5lARRDCAvekt25TeqA/",   "device_tokens": [], "password": "oZeZFMO9SpyDZw3lM", "apids": [], "device_pins": [],  "ua_device_id": "2A6651E5-6D23-4FAD-B53C-4D6356D7A2AA"}
  2013-03-19 04:22:44.336 MyApp[1070:907] [D] -[UAUser updateDefaultDeviceToken] [Line 978] Updating device token.
 2013-03-19 04:22:44.338 MyApp[1070:907] [D] -[UAUser updateDefaultDeviceToken] [Line 981] Skipping device token update: no token, already up to date, or user is being updated.
 2013-03-19 04:22:58.766 F

AirshipConfig.plistにDEVELOPMENT_APP_SECRETとDEVELOPMENT_APP_KEYがあり、APP_STORE_OR_AD_HOC = NO

4

2 に答える 2

1

私は、構成中に何かがいくつかのステップを欠いていると思います:

https://docs.urbanairship.com/display/DOCS/Getting+Started:+iOS:+Pushをもう一度ご覧ください

AppDelegateにトークンを記録してみてください。

-(void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
NSLog(@"My token is: %@", deviceToken);
[[UAPush shared] registerDeviceToken:deviceToken];
}

AirshipConfig.plistファイルも更新します

誤って構成された証明書/プロビジョニングプロファイルの問題である可能性があります。

于 2013-03-19T09:52:27.577 に答える
0

私も同じ問題を抱えていました。DEVELOPMENT_APP_SECRET と DEVELOPMENT_APP_KEY がありますが、UrbanAirship lib は PRODUCTION_APP_SECRET と PRODUCTION_APP_KEY を想定していると思います。それらを AirshipConfig.plist に追加すると、問題は解決し、UrbanAirship を介してプッシュ メッセージを送信できるようになりました。

于 2013-12-05T12:06:36.920 に答える