From 293fa7f09f8df8e00aeceb5739fdc6302efe6299 Mon Sep 17 00:00:00 2001 From: Blake Watters Date: Fri, 14 Aug 2009 17:28:48 -0400 Subject: [PATCH] Cleanups --- OTRestFramework.xcodeproj/project.pbxproj | 16 ++++++++++++++++ OTRestModelMapper.m | 8 ++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/OTRestFramework.xcodeproj/project.pbxproj b/OTRestFramework.xcodeproj/project.pbxproj index 8a62ded2..eb7f99ad 100644 --- a/OTRestFramework.xcodeproj/project.pbxproj +++ b/OTRestFramework.xcodeproj/project.pbxproj @@ -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 = ""; @@ -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 = ""; + }; 3F4E18DB102DD31E00320118 /* libElementParser.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; diff --git a/OTRestModelMapper.m b/OTRestModelMapper.m index 255b3fce..974f6e9d 100644 --- a/OTRestModelMapper.m +++ b/OTRestModelMapper.m @@ -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];