我有一個UIAlertView塊,我想點擊OK後運行一些代碼。UIAlertView在塊內部崩潰
- (IBAction)connectToAccount:(UIButton *)sender {
void (^block) (FTjsonRecords *obj, NSError *error) = ^(FTjsonRecords *obj, NSError *error) {
[self updateInterfaceWithReachability:self.hostReachability];
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Success!"
message:@"Online sync is now enabled."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[av show];
};
[sync checkFirstLogin:email viaPassword:password viaCompletion:block];
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
[[self navigationController] popToRootViewControllerAnimated:NO];
NSNotification *note = [NSNotification notificationWithName:IOS_SWITCH_TAB object:nil];
[[NSNotificationCenter defaultCenter] postNotification:note];
}
當我點擊確定,應用程序崩潰,沒有任何例外跟進。 我不知道如何繼續。建議會很好。由於
UPDATE:
我已經設置[av show];
一個破發點的權利和螺紋看起來是這樣的:
該塊是否在主隊列/線程上執行? –
@斯科特我相信它是。請參閱最新的問題。謝謝 – Houman
完成塊是否通過複製正確地移動到堆中? – Sulthan