2015-02-05 2 views
0

NSDictionary의 파일 표현을 Parse.com에서 요청하고 있습니다 (예를 들어 사전을 저장할 다른 명확한 방법이 있다는 것을 알고 있습니다). 그런 다음 완료 블록에서 데이터가 보관되지 않고 재산에 배정 된NSKeyedUnarchiver unarchiveObjectWithData : 구문 분석 블록 함수에서 절대 반환하지 않습니다.

이 코드를 실행하면 보관 취소 선에서 돌아 오지 않는 것처럼 보입니다. 멈추지 않고 오류나 예외가 없습니다. 앱은 마치 모든 것이 잘되는 것처럼 계속 실행됩니다. unarchiver 라인과 그 이후의 라인에서 중단 점을 설정하면 첫 번째 중단 점에 도달하지만 두 번째 중단 지점에는 도달하지 않습니다.

이 함수가이 파일의 예상 데이터 양을 반환했는지 확인할 수 있습니다.

PFFile *definitionFile = appObject[@"myFile"]; //PFFile reference from a PFObject 
[definitionFile getDataInBackgroundWithBlock:^(NSData *data, NSError *error) { 
    if (!error) { 
     if (data) { 
      //A breakpoint on the following line does fire and show that there is data being given to the unarchiver 
      self.pendingDefinition = (NSDictionary *) [NSKeyedUnarchiver unarchiveObjectWithData:data]; 
     } 
     //////Nothing beyond this point gets executed//////// 
     [self handleNewDefinition]; 
    } else { 
     NSLog(@"ERROR"); 
    } 
}]; 
+1

는 NSKeyedArchiver로 인코딩되는 구문 분석에서 사용자에게 전송 데이터인가? NSKeyedUnarchiver는 NSKeyedArchiver로 인코딩 된 객체를 보관 취소합니다. – Msencenb

+0

그게 전부입니다. 데이터는 plist로 저장됩니다. plist 직렬화를 사용해야합니다. – Dancreek

답변

0

IT는 PLIST로 저장되어 있던 데이터를 보니 나는 그것을 추출 PLIST 직렬화를 사용하는 데 필요한 :

if (data) { 
      NSError *error; 
      NSPropertyListFormat format; 
      NSDictionary* plist = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:&format error:&error]; 
      if(!plist){ 
       NSLog(@"Error: %@",error); 
      }