我似乎无法让 SLComposeViewController 来自 cocos2D 层上的按钮。如果你能看到任何会阻止这个工作的东西,请告诉。任何帮助将不胜感激:NB viewController is a UIViewController
-(void)sceneSelect
{
NSString *message = [NSString stringWithFormat:@"Twitter Message"];
NSString *serviceType = [NSString stringWithFormat:@"SLServiceTypeTwitter"];
if ([SLComposeViewController isAvailableForServiceType:serviceType])
{
SLComposeViewController *tweetController = [SLComposeViewController composeViewControllerForServiceType:serviceType];
[tweetController setInitialText:message];
tweetController.completionHandler = ^(SLComposeViewControllerResult result){
if (result == SLComposeViewControllerResultDone){
//NSLog call
}
else if (result == SLComposeViewControllerResultCancelled){
//NSLog call
}
[viewController dismissViewControllerAnimated: YES completion: nil];
};
[[[CCDirector sharedDirector]openGLView]addSubview:viewController.view];
[viewController presentViewController:tweetController animated:YES completion:nil];
}
else
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Twitter" message:@"Twitter not working" delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
[alertView show];
}
}