0
後訪問對象我現在已經成功的對象映射。嗬!我現在的問題是如何在我的項目中訪問這個對象?我用RestKit映射一個JSON響應於APIUser對象。在下一屏幕上,例如,我想從APIUser對象獲取用戶的名字打招呼。我如何訪問該對象?如何繼<a href="https://github.com/RestKit/RestKit/wiki/Object-mapping" rel="nofollow">RestKit documentation here</a>成功後RestKit映射
我是新來的Objective-C,所以這可能是更多的是關於使用全局對象,單班,以及跨在Objective-C類持續數據的問題,也包含RestKit框架。
這裏是我的restkit對象映射日誌,以防引用它。謝謝。任何幫助表示讚賞。
2012-07-30 14:54:04.813 TestApp[2361:1a707] D restkit.object_mapping:RKObjectMapper.m:240 Performing object mapping sourceObject: {
apiUser = {
active = 1;
apiUserIdx = 101;
birthdate = "1980-06-21T00:00:00-06:00";
countryCode = US;
firstName = "test_user1_firstname";
lastName = "test_user1_lastname";
ssn = 1111;
userName = "test_user1";
verified = 1;
};
}
and targetObject: (null)
2012-07-30 14:54:04.813 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMapper.m:254 Examining keyPath 'errors' for mappable content...
2012-07-30 14:54:04.813 TestApp[2361:1a707] D restkit.object_mapping:RKObjectMapper.m:264 Found unmappable value at keyPath: errors
2012-07-30 14:54:04.814 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMapper.m:254 Examining keyPath 'apiUser' for mappable content...
2012-07-30 14:54:04.814 TestApp[2361:1a707] D restkit.object_mapping:RKObjectMapper.m:283 Found mappable data at keyPath 'apiUser': {
active = 1;
apiUserIdx = 101;
birthdate = "1980-06-21T00:00:00-06:00";
countryCode = US;
firstName = "test_user1_firstname";
lastName = "test_user1_lastname";
ssn = 1111;
userName = "test_user1";
verified = 1;
}
2012-07-30 14:54:04.814 TestApp[2361:1a707] D restkit.object_mapping:RKObjectMapper.m:189 Asked to map source object {
active = 1;
apiUserIdx = 101;
birthdate = "1980-06-21T00:00:00-06:00";
countryCode = US;
firstName = "test_user1_firstname";
lastName = "test_user1_lastname";
ssn = 1111;
userName = "test_user1";
verified = 1;
} with mapping RKObjectMapping class => APIUser: keyPath mappings => (
"RKObjectKeyPathMapping: lastName => lastName",
"RKObjectKeyPathMapping: birthdate => birthdate",
"RKObjectKeyPathMapping: countryCode => countryCode",
"RKObjectKeyPathMapping: firstName => firstName",
"RKObjectKeyPathMapping: password => password",
"RKObjectKeyPathMapping: apiUserIdx => apiUserIdx",
"RKObjectKeyPathMapping: active => active",
"RKObjectKeyPathMapping: userName => userName",
"RKObjectKeyPathMapping: verified => verified"
)
2012-07-30 14:54:04.815 TestApp[2361:1a707] D restkit.object_mapping:RKObjectMappingOperation.m:428 Starting mapping operation...
2012-07-30 14:54:04.816 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:242 Mapping attribute value keyPath 'lastName' to 'lastName'
2012-07-30 14:54:04.816 TestApp[2361:1a707] D restkit.object_mapping:RKObjectPropertyInspector.m:95 Cached property names and types for Class 'APIUser': {
accessibilityHint = NSString;
accessibilityLabel = NSString;
accessibilityLanguage = NSString;
accessibilityValue = NSString;
birthdate = NSDate;
countryCode = NSString;
firstName = NSString;
lastName = NSString;
password = NSString;
userName = NSString;
}
2012-07-30 14:54:04.818 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:252 Mapped attribute value from keyPath 'lastName' to 'lastName'. Value: test_user1_lastname
2012-07-30 14:54:04.818 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:242 Mapping attribute value keyPath 'birthdate' to 'birthdate'
2012-07-30 14:54:04.818 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:115 Found transformable value at keyPath 'birthdate'. Transforming from type '__NSCFString' to 'NSDate'
2012-07-30 14:54:04.818 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:97 Transforming string value '1980-06-21T00:00:00-06:00' to NSDate...
2012-07-30 14:54:04.819 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:259 Skipped mapping of attribute value from keyPath 'birthdate to keyPath 'birthdate' -- value is unchanged ((null))
2012-07-30 14:54:04.821 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:242 Mapping attribute value keyPath 'countryCode' to 'countryCode'
2012-07-30 14:54:04.822 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:252 Mapped attribute value from keyPath 'countryCode' to 'countryCode'. Value: US
2012-07-30 14:54:04.822 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:242 Mapping attribute value keyPath 'firstName' to 'firstName'
2012-07-30 14:54:04.822 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:252 Mapped attribute value from keyPath 'firstName' to 'firstName'. Value: test_user1_firstname
2012-07-30 14:54:04.822 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:291 Did not find mappable attribute value keyPath 'password'
2012-07-30 14:54:04.823 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:242 Mapping attribute value keyPath 'apiUserIdx' to 'apiUserIdx'
2012-07-30 14:54:04.839 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:252 Mapped attribute value from keyPath 'apiUserIdx' to 'apiUserIdx'. Value: 101
2012-07-30 14:54:04.840 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:242 Mapping attribute value keyPath 'active' to 'active'
2012-07-30 14:54:04.840 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:252 Mapped attribute value from keyPath 'active' to 'active'. Value: 1
2012-07-30 14:54:04.840 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:242 Mapping attribute value keyPath 'userName' to 'userName'
2012-07-30 14:54:04.840 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:252 Mapped attribute value from keyPath 'userName' to 'userName'. Value: test_user1
2012-07-30 14:54:04.841 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:242 Mapping attribute value keyPath 'verified' to 'verified'
2012-07-30 14:54:04.845 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMappingOperation.m:252 Mapped attribute value from keyPath 'verified' to 'verified'. Value: 1
2012-07-30 14:54:04.845 TestApp[2361:1a707] D restkit.object_mapping:RKObjectMappingOperation.m:434 Finished mapping operation successfully...
2012-07-30 14:54:04.846 TestApp[2361:1a707] T restkit.object_mapping:RKObjectMapper.m:254 Examining keyPath 'error' for mappable content...
2012-07-30 14:54:04.846 TestApp[2361:1a707] D restkit.object_mapping:RKObjectMapper.m:264 Found unmappable value at keyPath: error
2012-07-30 14:54:04.846 TestApp[2361:1a707] D restkit.object_mapping:RKObjectMapper.m:304 Finished performing object mapping. Results: {
apiUser = "<APIUser: 0xcd8b170>";
}