Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';将数据从unity3d传递到iOS时,不要推送另一个viewcontroller_Ios_Objective C_Unity3d_Uiviewcontroller_Extern C - Fatal编程技术网

Can';将数据从unity3d传递到iOS时,不要推送另一个viewcontroller

Can';将数据从unity3d传递到iOS时,不要推送另一个viewcontroller,ios,objective-c,unity3d,uiviewcontroller,extern-c,Ios,Objective C,Unity3d,Uiviewcontroller,Extern C,我在unity 3d和iOS之间架起了一座传递数据的桥梁。我可以使用extern“C”成功地将数据从unity 3d发送到我的iOS,然后我可以从extern“C”方法调用objective C方法。但是从objective c方法来看,如果我想推送另一个viewcontroller,那么它会崩溃并显示以下问题 A view can only be associated with at most one view controller at a time! View is associated

我在unity 3d和iOS之间架起了一座传递数据的桥梁。我可以使用extern“C”成功地将数据从unity 3d发送到我的iOS,然后我可以从extern“C”方法调用objective C方法。但是从objective c方法来看,如果我想推送另一个viewcontroller,那么它会崩溃并显示以下问题

A view can only be associated with at most one view controller at a time! View is associated with Clear this association before associating this view with...
我如何解决这个问题

以下是我的视图控制器类:

@implementation ARViewController


- (void)viewDidLoad
{
    [super viewDidLoad];

    // Just setting Unity delegates and view to add it as subview for my main view.
    // This allow me to add a UIButton above the UnityView to popViewController or anything i want to make native in iOS.

    unityViewController         = [[UnityDefaultViewController alloc] init];
    unityController             = (UnityAppController*)[[UIApplication sharedApplication] delegate];
    unityViewController.view    = (UIView*)unityController.unityView;

    [viewToUnity addSubview:unityViewController.view];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)gotoAnotherViewController
{

    ViewController *arVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"ClickVC"];
    [self presentViewController:arVC animated:YES completion:nil];

    dispatch_async(dispatch_get_main_queue(), ^{

    });
}

@end

extern "C" {

    void _NativeMethodName(const char* stringValue)
    {
        [[ARViewController new] gotoAnotherViewController];
        NSLog(@"Passed string value: %s", stringValue);
    }

}

你不允许在另一个控制器中有一个控制器。那么我如何解决这个问题?它是否在viewdidload上崩溃?不,它在GoToAnothServiceWController方法中崩溃,我试图推送另一个视图控制器。我想这是unity 3d视图控制器在调用Extern c block时出现的问题。该视图控制器处于活动状态,我正在尝试从违反操作系统规则的ios推送视图控制器。从unity3d切换到iOS后,有没有办法从iOS推送viewcontroller?