2013-10-22 69 views
0

有沒有人可以幫助我。我構建了一個iOS插件,當我嘗試呈現一個ViewController時出現錯誤。 「[FacebookPlugin showFBPost]:無法識別的選擇發送到實例0x21240b00 (LLDB)」在iOS中調用UIViewController

這裏是我想調用的代碼。在此先感謝您的幫助。

#import "FPlugin.h" 
#import "FSendViewController.h" 
#import "UnityAppController.h" 

#pragma mark - Unity methods 

@implementation FPlugin 

extern UIViewController *UnityGetGLViewController(); 

void showFBPost(){ 

UIStoryboard *mainStoryBoad = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone"  bundle:[NSBundle mainBundle]]; 
UIViewController *vc = [mainStoryBoad instantiateViewControllerWithIdentifier:@"MainViewController"]; 
vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
UIViewController *rootViewController = UnityGetGLViewController(); 
//[rootViewController presentViewController:vc animated:YES completion:^(){}]; 
[rootViewController presentModalViewController:vc animated:YES]; 

} 

extern "C" void ShowFBPost() 
{ 
    FPlugin * obj = [FPlugin alloc]; 
    [obj showFBPost]; 
    [obj release]; 
} 

@end 

以前用XIB1它通過這個

UIViewController *rootViewController = UnityGetGLViewController(); 
SendFacebookViewController *sfvc = [[SFViewController alloc]  initWithNibName:@"SendFacebookViewController" bundle:nil]; 

[rootViewController presentModalViewController:sfvc animated:YES]; 

[sfvc release]; 
+1

的統一標記是微軟統一。請不要濫用它。 –

+0

@Lex。 \謝謝 –

回答

1

工作得很好,我發現通過改變它的問題,這個

extern "C" void ShowFBPost() 
{ 
    //FPlugin * obj = [FPlugin alloc]; 
    //[obj showFBPost]; 
    //[obj release]; 

    showFBPost(); 

} 
/* Note: File extension .mm */ 
相關問題