2014-10-21 3 views
0

Parse를 사용하고 XCode 6 (Yosemite 설치)으로 업그레이드했습니다. 그때까지는 앱이 정상적으로 작동했지만 이제는 첫 번째 화면 (로그인보기 컨트롤러)을로드하지도 않습니다.잡히지 않은 예외로 인해 앱이 종료 됨 iOS

다음은 오류 메시지입니다 :

2014-10-21 00:30:34.754 Hi App[393:143637] *** Terminating app due to uncaught exception  
'NSInvalidArgumentException', reason: 'Cannot do a comparison query for type: (null)' 
*** First throw call stack: 
(0x25e03e3f 0x334b1c8b 0x25e03d85 0x8d173 0x785fd 0x5fee3 0x292b785f 0x2934b51f 0x2934aff3 
0x2934ad5d 
0x2934acf1 0x2929f677 0x28cc7ccd 0x28cc36b5 0x28cc353d 0x28cc2f21 0x28cc2d25 0x29503395 0x2950413d 
0x2950e549 0x29502557 0x2c5450e9 0x25dca5b5 0x25dc9879 0x25dc83b3 0x25d16621 0x25d16433 
0x2930656f  
0x29301359 0x5d1b5 0x33a31aaf) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
(lldb) 

가 여기 내 loginviewcontroller.m입니다 :

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    self.navigationItem.hidesBackButton = YES; 
} 


- (IBAction)login:(id)sender { 
    NSString *username = [self.enterUsername.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 
    NSString *password = [self.enterPassword.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 

    if ([username length] == 0 || [password length] == 0) { 
     UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oops!" 
                  message:@"Please enter a username, password." 
                  delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
     [alertView show]; 

    } 
    [PFUser logInWithUsernameInBackground:username password:password block:^(PFUser *user, NSError 
    *error) { 
    if (error) { 
     UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sorry!" 
                  message:[error.userInfo 
objectForKey:@"error"] 
                  delegate:nil cancelButtonTitle:@"OK" 
otherButtonTitles:nil]; 
     [alertView show]; 
    } 
    else { 
     [self.navigationController popToRootViewControllerAnimated:YES]; 
    } 
}]; 
} 
+1

오류는 매우 명확합니다. '유형에 대한 비교 쿼리를 수행 할 수 없습니다 : (null)'그래서 사용자 이름이나 비밀번호가 0이 아닌지 다시 한 번 확인합니다. – Lefteris

답변

0

내가 처음 한 번 확인 사용자 이름과 암호가 전무하지 있는지 확인하는 것입니다. 물론 비밀 번호와 사용자 이름 길이가 0이 아닌지 확인하는 검사가 있습니다.

이 검사의 문제점은 입니다. 확인 중이며 UIAlert가 표시되고 나머지 코드는 계속 남아 있습니다. 실행 된.

복귀하여 함수를 종료하거나 나머지 실행을 else 문으로 끝냅니다.

이 밖으로 시도 :

if ([username length] == 0 || [password length] == 0) { 
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oops!" 
                 message:@"Please enter a username, password." 
                 delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
    [alertView show]; 
    return; 
} 
+0

안녕하세요, 어떻게 돌려 받으시겠습니까? 나는 방법으로 돌아갈 수 없다고 말합니다. – Tam

+0

몇 가지 코드를 추가했습니다. – SuperKevin

+0

여전히 작동하지 않습니다. 아마도 PFQuery에 문제가 있습니까? 다음은 중단 점입니다. 0xc3c1c : jmp 0xc3c2f; + [PFInternalUtils assertValidClassForQuery :] + 394 at PFInternalUtils.m : 406 – Tam

0

내가 기술적으로 프로젝트의 일부를 재 구축하여 그것을 해결. 나는 그 문제가 무엇인지 모르지만, iOS 8과 섞어 놓은 오래된 파일들과 관련이있을 것입니다. 나는 iPhone 5 7.1에서 새 프로젝트를 컴파일하고 작동합니다.

관련 문제