1

我正在开发一个游戏,我必须在我的 Facebook 和 twitter a/c 上发布分数。

我已经编写了这段代码,但它不起作用。它既不会给出任何错误,也不会弹出任何发布内容。

  - (void) SLComposeViewControllerButtonPressed: (id) sender{

 if([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
{

    AppDelegate * myDelegate = (((AppDelegate*) [UIApplication sharedApplication].delegate));

    NSString *string = [NSString stringWithFormat:@"Just scored %d. ", 10];

    SLComposeViewController*fvc = [SLComposeViewController
                                   composeViewControllerForServiceType:SLServiceTypeTwitter];
    [fvc setInitialText:string];
     [[myDelegate navController]  presentViewController:fvc animated:YES completion:nil];
}

请给我这个问题的有效解决方案。

4

1 回答 1

4

CCDirectorUIViewControlleriOS 中的子类。所以它可以用于呈现模态视图控制器。

[[CCDirector sharedDirector] presentViewController:fvc animated:YES completion:nil];

更新:这是一个文档

  #ifdef __CC_PLATFORM_IOS
  #define CC_VIEWCONTROLLER UIViewController
  #elif defined(__CC_PLATFORM_MAC)
  #define CC_VIEWCONTROLLER NSObject
  #endif

  @interface CCDirector : CC_VIEWCONTROLLER
于 2013-09-09T05:24:22.503 回答