如何分别取得成就

时间:2011-11-22 03:04:42

标签: iphone ipad xcode4 game-center

我在iPhone的游戏中心取得了成就,但我的应用程序是通用的,所以我在iPad上取得了成就我不希望它们与iPhone成就一起显示我希望它们都是单独的

  -(void)checkAchievements6
 {
 if(score>10000)//achievement for getting 10000 points.
  {
    GKAchievement *achievement= [[GKAchievement alloc] initWithIdentifier:@"5Digit"];
    achievement.percentComplete = 100.0;
    achievement.showsCompletionBanner=YES;
if(achievement!= NULL)
{
    [achievement reportAchievementWithCompletionHandler: ^(NSError *error)
     {
         if(error != nil){
             NSLog(@"Achievement failed");
         }
         else 
         {
             NSLog(@"Achievement Success");
         }

     }];
}
   }
  }

1 个答案:

答案 0 :(得分:0)

我不确定这是不是你问的问题,但可能是这样吗?

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
    //iPhone achievement code
} else {
    //iPad achievement code
}