當試圖執行這條線,位於一個單獨的函數:錯誤呈現的ViewController
[self presentViewController:selectVC_ animated:YES completion:nil];
我收到此錯誤:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
我的聲明和實例都位於同一個文件
@class typesel_vc;
@interface
@property(nonatomic,strong)typesel_vc *selectVC;
@implementation
@synthesize selectVC=selectVC_;
-(void)viewDidAppear:(BOOL)animated{
selectVC_=[[typesel_vc alloc]init];
}
有關如何處理此錯誤的任何想法?
編輯:
實際行,我叫presentViewController
selectVC_=[[typesel_vc alloc]init];
[self presentViewController:selectVC_ animated:YES completion:nil];
能否請您提供調用堆棧? – dlackty 2013-02-19 18:38:47
問題很簡單 - 在您調用presentViewController時,您的'selectVC_' ivar是'nil'。你需要確定原因。 – rmaddy 2013-02-19 18:41:54
你的代碼清單中的@interface之後似乎缺少一個類名 – 2013-02-19 18:47:40