mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-01-12 22:51:50 +08:00
Cleanups
This commit is contained in:
@@ -54,6 +54,13 @@
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
25FCE0A310360373005418A7 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 3F4E18D6102DD31E00320118 /* ElementParser.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 25FCE09E10360372005418A7 /* Tests.octest */;
|
||||
remoteInfo = Tests;
|
||||
};
|
||||
3F4E18DA102DD31E00320118 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 3F4E18D6102DD31E00320118 /* ElementParser.xcodeproj */;
|
||||
@@ -219,6 +226,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3F4E18DB102DD31E00320118 /* libElementParser.a */,
|
||||
25FCE0A410360373005418A7 /* Tests.octest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -334,6 +342,14 @@
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
25FCE0A410360373005418A7 /* Tests.octest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
name = Tests.octest;
|
||||
path = build/Debug/Tests.octest;
|
||||
remoteRef = 25FCE0A310360373005418A7 /* PBXContainerItemProxy */;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3F4E18DB102DD31E00320118 /* libElementParser.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
NSString* typeHint = [propertyElement attribute:@"type"];
|
||||
id propertyValue = nil;
|
||||
if ([typeHint isEqualToString:@"string"] ||
|
||||
typeHint == nil) {
|
||||
typeHint == nil) {
|
||||
propertyValue = [propertyElement contentsText];
|
||||
} else if ([typeHint isEqualToString:@"integer"] ||
|
||||
[typeHint isEqualToString:@"float"]) {
|
||||
@@ -86,13 +86,12 @@
|
||||
} else if ([typeHint isEqualToString:@"boolean"]) {
|
||||
propertyValue = [NSNumber numberWithBool:[[propertyElement contentsText] isEqualToString:@"true"]];
|
||||
} else if ([typeHint isEqualToString:@"datetime"]) {
|
||||
NSDate* date;
|
||||
NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
|
||||
// Times coming back are in utc. we should convert them to the local timezone
|
||||
// TODO: Make sure this is working correctly
|
||||
[formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
|
||||
[formatter setDateFormat:kRailsToXMLDateFormatterString];
|
||||
date = [formatter dateFromString:[propertyElement contentsText]];
|
||||
propertyValue = [formatter dateFromString:[propertyElement contentsText]];
|
||||
[formatter release];
|
||||
} else if ([typeHint isEqualToString:@"nil"]) {
|
||||
propertyValue = nil;
|
||||
@@ -127,7 +126,8 @@
|
||||
// If the parent element doesn't appear, we will not set the collection to nil.
|
||||
NSString* containingElementName = [self containingElementNameForSelector:selector];
|
||||
if ([XML selectElement:containingElementName] != nil) {
|
||||
for (Element* childElement in [XML selectElements:selector]) {
|
||||
NSArray* childrenElements = [XML selectElements:selector];
|
||||
for (Element* childElement in childrenElements) {
|
||||
[children addObject:[self buildModelFromXML:childElement]];
|
||||
}
|
||||
[model setValue:(NSSet*)children forKey:propertyName];
|
||||
|
||||
Reference in New Issue
Block a user