简体   繁体   中英

Integrate IOS Framework (Objective C) in Kony project

I developed an IOS Framework (objective C) and want to integrate it in Kony project. The Framework function to be called will display a UIView.

This function was used in Kony project to load the UI :

- (void)viewDidLoad {
    [super viewDidLoad];
    GlobalVariables = [GlobalVars sharedInstance];
    CameraBioselfie *cam;
    cam =[[CameraBioselfie alloc] init];
    [self presentViewController:cam animated:YES completion:nil];
    [self.view addSubview:[cam window]];

    dispatch_group_t group = dispatch_group_create(); dispatch_group_async(group,dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ {
        while (GlobalVariables.response.length==0 && GlobalVariables.error.length==0){

        }
        if(GlobalVariables.response.length==0){
            self.result =GlobalVariables.error;
        }
        else if([GlobalVariables.response containsString:GlobalVariables.username]){
            self.result = @"Recognized";
        }
        else{
            self.result = GlobalVariables.response;
        }

        NSArray *status = @[self.result];
        [self.callbackfunction executeWithArguments:status];

        dispatch_sync(dispatch_get_main_queue(), ^{
            [self dismissViewControllerAnimated:YES completion:nil];
        });
    });
}

When it gets to this line:

[self.view addSubview:[cam window]];

I receive the following error:

This application is modifying the auto layout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.

Please note that if the framework is integrated in an Xcode objective c project and called the same way, i don't have this issue

Once try by adding subview on main thread like,

  dispatch_async(dispatch_get_main_queue(), ^{


   [self.view addSubview:[cam window]];

 });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM