我真的很新的Xcode和iPhone的發展。我在我的appDelegate.m
文件中寫了一個名爲getISlogged;
的函數。它是這樣的:- (布爾)不返回
- (BOOL) getISlogged {
NSUserDefaults *usenow = [NSUserDefaults standardUserDefaults];
NSNumber *islog = nil;
if(usenow){
islog = [usenow objectForKey:@"is_log"]; // should equal 1 or 0...
}
UIAlertView * alert1 = [[UIAlertView alloc] initWithTitle:@"works" message:@"test1" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles: nil];
[alert1 show];
if (islog == [NSNumber numberWithInt:(1)]) {
return YES;
} else {
return NO;
}
}
好了,現在我把它從我的viewController.m
像這樣:
SWGAppDelegate *appDelegate = (SWGAppDelegate *)[[UIApplication sharedApplication]delegate];
NSString *islog = @"no";
if(appDelegate.getISlogged){
[email protected]"yes";
}
現在,當我運行它,我總是得到Thread 1: breakpoint 2.1
,我不知道什麼做那。我試圖刪除所有的代碼,只留下return YES;
在功能,我仍然得到相同的錯誤= \
任何幫助或提示將有助於感謝你。
你肯定你有沒有不小心添加了一個斷點? :) –