내 .plist가 소스 코드로 viwed되었을 때 XML 파일이 아닌 것처럼 보이는 이유를 잘 모릅니다.plist에서 항목 수 반환
{
authorLastName = Doe;
authorFirstName = Jane;
imageFilePath = "NoImage.png";
title = "Account Test 1";
year = 2009;
},
{
authorLastName = Doe;
authorFirstName = John;
imageFilePath = "NoImage.png";
title = "Account Test 2";
year = 2009;
}
. 소스 코드로 볼 때 .plist는이 모양이어야합니까?
둘째, 누구나 항목 수를 어떻게 늘릴 수 있습니까? 예를 들어 각 사전의 성을 입력 할 수 있습니까? 나는 이것을 너무나 많은 시간 동안 연구했고, 내 머리카락을 끌어 당기면서 나는 이것이 정확해질 때까지 계속 움직이지 않는다! 내가 시도하는 모든 메소드는 0을 반환합니다. iPhone 프로그래밍에서 정말 새로운 점입니다. 그래서 얻을 수있는 도움에 감사드립니다! 어쩌면 plist를 읽는 완전한 예제가 될까요?
있는 NSArray * = 경로의 NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString * documentsDirectory = [경로 objectAtIndex : 0]; 는 NSString * myPlistPath = documentsDirectory \t \t \t \t \t \t stringByAppendingPathComponent "Accounts.plist"@]; NSArray * arr = [NSArray arrayWithContentsOfFile : myPlistPath]; int count = 0; for (NSDictionary * dict in arr) { \t count + = dict.count; } return count; ////////////////////////// 상기 라인 오류 시뮬레이터를 종료 "EXC_BAD_ACCESS" 프로그램 수신 신호. – WrightsCS