2012-09-12 5 views
0

playerduel 프레임 워크를 지원하는 애플리케이션을 개발 중입니다. 두 명의 플레이어가 서로 게임을 할 수 있습니다. 사람은 다른 사람에게 도전을 보낼 수 있습니다. 다음 문서를 따르십시오. https://docs.urbanairship.com/display/DOCS/Getting+Started%3A+iOS%3A+Pushplayerduel 기능이있는 앱은 푸시 알림을받지 않습니다.

위의 설명서에서 설명한대로 명령 줄 (테스트 용)에서 보낼 때 알림을받을 수 있습니다. 하지만 내가 게임을 할 때. 일부 사람이 다른 사람에게 챌린지를 보내는 경우 Playerdual은 알림을 보낼 수 없습니다.

AppDelegate에 코드 : -

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

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

// Create Airship singleton that's used to talk to Urban Airship servers. 
// Please populate AirshipConfig.plist with your info from http://go.urbanairship.com 
[UAirship takeOff:takeOffOptions]; 

// Register for notifications 
[[UAPush shared]registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | 
            UIRemoteNotificationTypeSound | 
            UIRemoteNotificationTypeAlert)]; 

// Override point for customization after application launch. 
self.appStarted = YES; 
UIImage *bgImage= [UIImage imageNamed:@"default.png"]; 
[PlayerDuel initializeWithGameKey:@"gamekey" andBackground:bgImage 
         andDelegate:[navigationController.viewControllers objectAtIndex:0] andOrientation:UIInterfaceOrientationPortrait]; 


- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 
NSLog(@"deviceToken:- %@",deviceToken); 
// Updates the device token and registers the token with UA 
[[UAPush shared] registerDeviceToken:deviceToken]; 
[PlayerDuel registerDeviceToken:deviceToken]; 

}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { 

for (id key in userInfo) { 
    NSLog(@"key: %@, value: %@", key, [userInfo objectForKey:key]); 
}  

NSLog(@"remote notification: %@",[userInfo description]); 

NSDictionary *apsInfo = [userInfo objectForKey:@"aps"]; 



NSString *alert = [apsInfo objectForKey:@"alert"]; 

NSLog(@"Received Push Alert: %@", alert); 



NSString *sound = [apsInfo objectForKey:@"sound"]; 

NSLog(@"Received Push Sound: %@", sound); 
NSString *itemName = @"my app"; 
NSString *messageTitle = [apsInfo objectForKey:@"alert"]; 
UIApplicationState state = [application applicationState]; 
if (state == UIApplicationStateActive){ 
    AudioServicesPlaySystemSound(1007); 
[self _showAlert:messageTitle withTitle:itemName]; 
} 
else{ 
    UIViewController *viewController = navigationController.visibleViewController; 
    //  NSLog(@"Controller Name:- %@",viewController); 
    [viewController.view reloadInputViews]; 
    [viewController playerDuelStartGame:nil]; 
} 
NSString *badge = [apsInfo objectForKey:@"badge"]; 

NSLog(@"Received Push Badge: %@", badge); 

}

답변

0

나는 App Secrete를 도시 비행선 열쇠로 사용했다 :. 이것은 잘못된 것입니다. 앱 키 값으로 바꿀 때. 그것은 잘 작동합니다.

2

푸시 알림 도시 비행선을하지 PlayerDuel를 통해 직접 작업하는 경우, 당신은 아마 권리를 지정하지 않았습니다 PlayerDuel 개발자 웹 사이트의 도시 비행선 세부 정보. PlayerDuel의 웹 사이트에 Urban Airship의 Master Secret을 넣고 App Secret을 넣지 않도록하십시오.

+0

답변 해 주셔서 감사합니다. –

관련 문제