0

我的代码无法在设备上运行,有人可以帮忙吗?

- (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];
        }
}

在模拟器上执行此代码时,它工作正常,但在设备上,应用程序NSLog(_post, nil);TweetPost方法后立即崩溃。我认为这是由于ENSURE_UI_THREAD(Tweet, args);. 谁能帮我吗..?

4

1 回答 1

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.

于 2012-04-23T13:00:37.847 回答