2012-03-12 16 views
1

UrbanAirship.comからリッチプッシュサンプルをコピーしました。 そして、アプリケーションデリゲートのdidFinishLaunchingWithOptionsで飛行船を初期化します。Urban Airship iOS向けリッチプッシュ通知、ユーザーは登録されていません

//Init Airship launch options 
NSMutableDictionary *takeOffOptions = [[[NSMutableDictionary alloc] init] autorelease]; 
[takeOffOptions setValue:launchOptions forKey:UAirshipTakeOffOptionsLaunchOptionsKey];  
NSMutableDictionary *analyticsOptions = [[[NSMutableDictionary alloc] init] autorelease]; 
[analyticsOptions setValue:@"NO" forKey:UAAnalyticsOptionsLoggingKey]; 
[takeOffOptions setValue:analyticsOptions forKey:UAirshipTakeOffOptionsAnalyticsKey]; 

リモート通知オブザーバを追加し、デバイストークンを登録します。 しかし、アプリケーションを実行した後、私はUrbanAirship.comのマイアプリの詳細ページでリッチプッシュユーザーを見つけることができません。 リッチプッシュ通知をテストできません。 どうしたの?私は答えを楽しみにしています。

(以下はログされている)

-[UAAnalytics initWithOptions:] [Line 216] Analytics logging not enabled 
MyApp[3285:707] -[UAUser migrateUser] [Line 187] Migrating User Info: (null) 
MyApp[3285:707] -[UAUser loadUser] [Line 268] User Info: (null) 
MyApp[3285:707] -[UAInboxMessageList loadSavedMessages] [Line 103] before retrieve saved messages: (null) 
MyApp[3285:707] -[UAInboxMessageList loadSavedMessages] [Line 109] after retrieve saved messages: (
) 
... 
MyApp[3285:707] applicationDidBecomeActive 
MyApp[3285:707] -[UAUser listenForDeviceTokenReg] [Line 964] ListenForDeviceTokenReg 
MyApp[3285:707] -[UAInboxMessageList requestWentWrong:] [Line 310] Inbox Message List Request Failed: Authentication needed 
MyApp[3285:707] -[UAirship setDeviceToken:] [Line 306] Device token: daa75616a2f9b2b2c5e8e42fe6236cae031be082a3e3ddf1af6b00d8ad444444 
MyApp[3285:707] -[UAUser observeValueForKeyPath:ofObject:change:context:] [Line 996] KVO device token modified 
MyApp[3285:707] -[UAUser updateDefaultDeviceToken] [Line 1011] Updating device token 
MyApp[3285:707] -[UAUser updateDefaultDeviceToken] [Line 1016] Skipping device token update: no token, already up to date, or user is being updated. 
MyApp[3285:707] -[UAUser retrieveRequestFailed:] [Line 935] User retrieval failed: 401:Authorization Required 
MyApp[3285:707] -[UAirship registerDeviceTokenSucceeded:] [Line 334] Device token registered on Urban Airship successfully. 

答えて

2

私は同じ問題を抱えていました。 UrbanAirshipの答えはhereです - 一度の解決策として、DELETE_KEYCHAIN_CREDENTIALS = YESの設定ファイルを追加してください。私はUA設定ファイルを作成しますが、私はAirshipConfig.plistを使用しないので、必要に応じてこの行を追加できるように設定を変更しました。ここで

は私が設定配列を構築するために使用するコードです:これを実行した後

- (void)urbanAirshipTakeoffWithLaunchOptions:(NSDictionary *)launchOptions { 

    // Init Airship launch options 
    NSMutableDictionary *takeOffOptions = [[NSMutableDictionary alloc] init]; 
    [takeOffOptions setValue:launchOptions forKey:UAirshipTakeOffOptionsLaunchOptionsKey]; 

    // Build the Urban Airship TakeOffOptions 
    NSMutableDictionary *airshipConfigOptions = [[NSMutableDictionary alloc] init]; 

    /* 
    * Set up the Push keys based on target 
    */ 

    // TARGET1 
#ifdef TARGET1 
    NSLog(@"Urban Airship - Target TARGET1"); 
    [airshipConfigOptions setValue:@"xxxxxxxxxxxxxxxxxxxxxx" forKey:@"DEVELOPMENT_APP_KEY"]; 
    [airshipConfigOptions setValue:@"xxxxxxxxxxxxxxxxxxxxxx" forKey:@"DEVELOPMENT_APP_SECRET"]; 
    [airshipConfigOptions setValue:@"xxxxxxxxxxxxxxxxxxxxxx" forKey:@"PRODUCTION_APP_KEY"]; 
    [airshipConfigOptions setValue:@"xxxxxxxxxxxxxxxxxxxxxx" forKey:@"PRODUCTION_APP_SECRET"]; 
#endif 

    // TARGET2 
#ifdef TARGET2 
    NSLog(@"Urban Airship - Target TARGET2"); 
    [airshipConfigOptions setValue:@"xxxxxxxxxxxxxxxxxxxxxx" forKey:@"DEVELOPMENT_APP_KEY"]; 
    [airshipConfigOptions setValue:@"xxxxxxxxxxxxxxxxxxxxxx" forKey:@"DEVELOPMENT_APP_SECRET"]; 
    [airshipConfigOptions setValue:@"xxxxxxxxxxxxxxxxxxxxxx" forKey:@"PRODUCTION_APP_KEY"]; 
    [airshipConfigOptions setValue:@"xxxxxxxxxxxxxxxxxxxxxx" forKey:@"PRODUCTION_APP_SECRET"]; 
#endif 

    // TARGET3 
#ifdef TARGET3 
    NSLog(@"Urban Airship - Target TARGET3"); 
    [airshipConfigOptions setValue:@"xxxxxxxxxxxxxxxxxxxxxx" forKey:@"DEVELOPMENT_APP_KEY"]; 
    [airshipConfigOptions setValue:@"xxxxxxxxxxxxxxxxxxxxxx" forKey:@"DEVELOPMENT_APP_SECRET"]; 
    [airshipConfigOptions setValue:@"xxxxxxxxxxxxxxxxxxxxxx" forKey:@"PRODUCTION_APP_KEY"]; 
    [airshipConfigOptions setValue:@"xxxxxxxxxxxxxxxxxxxxxx" forKey:@"PRODUCTION_APP_SECRET"]; 
#endif 

    // If CONFIGURATION_Debug is definied, then use the development servers, else use the production servers 
#ifdef CONFIGURATION_Debug 
    [airshipConfigOptions setValue:@"NO" forKey:@"APP_STORE_OR_AD_HOC_BUILD"]; 
    NSLog(@"Using Development Servers at Urban Airship"); 
#else 
    [airshipConfigOptions setValue:@"YES" forKey:@"APP_STORE_OR_AD_HOC_BUILD"]; 
    NSLog(@"Using Production Servers at Urban Airship"); 
#endif 

    // Erase stored user information from keychain - set in settings? 
    if(self.getEraseUser) [airshipConfigOptions setValue:@"YES" forKey:@"DELETE_KEYCHAIN_CREDENTIALS"]; 

    // Set and start Urban Airship 
    [takeOffOptions setValue:airshipConfigOptions forKey:UAirshipTakeOffOptionsAirshipConfigKey]; 
    [UAirship takeOff:takeOffOptions]; 

    // If the application gets an UAInbox message id on launch open it up immediately. Only works for the default inbox 
    [UAInbox useCustomUI:[UAInboxUI class]]; //sample UI implementation 
    [UAInbox shared].pushHandler.delegate = [UAInboxUI shared]; 
    [UAInboxUI shared].inboxParentController = self.tabcontroller; 
    [UAInboxPushHandler handleLaunchOptions:launchOptions]; 

    if([[UAInbox shared].pushHandler hasLaunchMessage]) { 
     [[[UAInbox shared] uiClass] loadLaunchMessage]; 
    } 

    // Register for push notifications 
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | 
                      UIRemoteNotificationTypeSound | 
                      UIRemoteNotificationTypeAlert)]; 

} 

、私のログファイルは示しています

2012-03-30 10:32:33.505 iFlightBag[13792:707] -[UAInboxMessageList messageListReady:] [Line 188] after retrieveMessageList, messages: (
"4e825e6863051f2fed001efa - New User Welcome" 
) 
2012-03-30 10:32:33.632 ThisApp[13792:707] -[UAUser updatedDefaultDeviceToken:] [Line 1036] Updated Device Token response: 200 
2012-03-30 10:33:32.089 ThisApp[13792:707] +[UAKeychainUtils getDeviceID] [Line 263] Retrieved device id info from keychain. 
2012-03-30 10:33:32.090 ThisApp[13792:707] +[UAKeychainUtils getDeviceID] [Line 267] Device ID result is not nil. 

は、新しいユーザーが作成された表示します。私はエイリアスとタグに基づいてリッチテキストの受信トレイを使用しています。だから、ユーザー名は私のアプリケーションには影響しません。

私は何かを見逃しましたか?

+0

私はUrbanAirshipでアプリを再作成しました。 その後、動作します。 – ttotto

関連する問題