0

My code is not working on device, could anyone please help..?

- (id) TweetPost : (id) args {
    NSArray *arr = args;
    _post = [args objectAtIndex: 0];
    NSLog(_post, nil);
    [_post retain];
    ENSURE_UI_THREAD(Tweet, args);
}

- (id) Tweet : (id) args {
        NSLog(@"Routine Twitter Module", nil)
        if (![_engine isAuthorized]) {
            UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];
            if (controller) {
                [[TiApp app] showModalController:controller animated: YES];
            }
        } else {
            [_engine sendUpdate: _post];
        }
}

While executing this code, on simulator, it works fine but on device the App crashes, instantly after NSLog(_post, nil); in TweetPost method. I think this is due to ENSURE_UI_THREAD(Tweet, args);. Can anyone help me out..?

Paresh Thakor
  • 1,795
  • 2
  • 27
  • 47

1 Answers1

0

I have replaced the above both functions with:

 - (void) TweetPost : (id) args {
    NSArray *arr = args;
    _post = [arr objectAtIndex: 0];
    [_post retain];
    NSLog(_post, nil);

    [self Tweet: args];
}

- (void) Tweet : (id) args {
    NSLog(@"Routine Twitter Module", nil);
    ENSURE_UI_THREAD(Tweet, args);
    if (![_engine isAuthorized]) {
        UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];
        if (controller) {
            [[TiApp app] showModalController:controller animated: YES];
        }
    } else {
        [_engine sendUpdate: _post];
    }
}

And this is working fine. I don't know what was the error.

Paresh Thakor
  • 1,795
  • 2
  • 27
  • 47