2014-10-17 2 views

답변

1

을 돕는 덕분에 이상적으로 코드도 messagesInfo`가`있다`있는지 확인해야 목적-C

NSString *thePath = [[NSBundle mainBundle] pathForResource:@"YourCustom" ofType:@"plist"]; 
NSURL *theUrl = [NSURL fileURLWithPath:thePath]; 

id messagesInfo = [[NSDictionary dictionary] initWithContentsOfURL:theUrl]; 
if([messagesInfo isKindOfClass:NSDictionary]){ 
    NSLog(@"DictionaryFound"); 
} 
else{ 
    NSLog(@"Array Found"); 
} 
+0

을 통해 배열이나 아니다 nil'은 URL이 유효한 plist 파일 (또는 존재하지 않는 파일)을 참조하지 않는 경우를위한 것입니다. – rmaddy