我是目標新手。 我不明白爲什麼我的函數不起作用,它使函數返回時出現錯誤SIGBART。爲什麼返回功能發出SIGBART信號?
+ (NSArray*) jsonToArray:(NSString*)jsonString
{
id mappedObj = nil;
RKObjectMappingProvider* mapProv = [[RKObjectMappingProvider alloc] init];
RKObjectMapping* answerMapping = [SMAnswersWrapper entityMappingForSerializer];
answerMapping.objectClass = [NSMutableDictionary class];
[mapProv setSerializationMapping:answerMapping forClass:[SMAnswersWrapper class]];
RKObjectMapping *proofsEntityMapping = [SMEntityArrayWrapper entityMappingWithContentMapping:answerMapping];
[mapProv setMapping:proofsEntityMapping forKeyPath:@""];
if (jsonString)
{
id obj = [jsonString objectFromJSONString];
if (obj)
{
RKObjectMapper* mapper = [[RKObjectMapper alloc] initWithObject:obj mappingProvider:mapProv];
RKObjectMappingResult* res = [mapper performMapping];
mappedObj = [res asCollection];
[mapper release];
}
}
[mapProv release];
return [[[mappedObj content] retain] autorelease];
}
錯誤位置是在這一行:
return [[[mappedObj content] retain] autorelease];
謝謝。
編輯
我發現我的錯誤,我不能在[[[mappedObj content] retain] autorelease];
訪問的內容,我不得不投mappedObj。
檢查主文件並檢查'UIApplicationMain'是否正常。否則在代碼上放置斷點並檢查錯誤位置。 – Esha
也在'[mapProv setMapping:proofsEntityMapping forKeyPath:@「」]; '你需要提供一個合適的鍵路徑「Key」值。 – Esha
我也真的建議你移動到'ARC' – rckoenes