0

Is there anybody here can help me. I built a iOS plugin and when I try to present a ViewController there is an error. "[FacebookPlugin showFBPost]: unrecognized selector sent to instance 0x21240b00 (lldb) "

And here is the code I am trying to call. Thanks in advance for your help.

#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

Previously with xib it work well by this

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

[rootViewController presentModalViewController:sfvc animated:YES];

[sfvc release]; 
4

1 回答 1

1

I found the problem by change it to this

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

     showFBPost();

}
/* Note: File extension .mm */
于 2013-10-22T01:25:21.183 回答