Using methods from non-ARC libraries in an ARC project?

I use an excellent, but not ARC project: https://github.com/boredzo/iso-8601-date-formatter

I am trying to use the following method from this library, which is not ARC in an ARC project:

- (NSDate *) dateFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone; 

I tried:

 group.updatedAt = [formatter dateFromString:someString timeZone:[NSTimeZone localTimeZone]]; group.updatedAt = [formatter dateFromString:someString timeZone:*__autorelease [NSTimeZone localTimeZone]]; group.updatedAt = [formatter dateFromString:someString timeZone:(*__autoreleasing [NSTimeZone localTimeZone]] *); group.updatedAt = [formatter dateFromString:someString timeZone:[[NSTimeZone localTimeZone] autorelease]]; 

Please note that I'm pretty new to iOS, so I have no memory management experience.

But with all these attempts, I received the following error message:

 Implicit conversion of an Objective-C pointer to 'NSTimeZone *__autoreleasing *' is disallowed with ARC 

So how to use library methods other than ARC in an ARC project?

+1
ios objective-c cocoa-touch automatic-ref-counting
May 11 '13 at 1:39
source share
1 answer

NSTimeZone is an output parameter, so you need to pass a pointer to a pointer, for example:

 NSTimeZone *theTimeZone = nil; group.updatedAt = [formatter dateFromString:someString timeZone:&theTimeZone]; 

When the function returns, theTimeZone will be set to the output value of the function.

+3
May 11 '13 at 1:42
source share
β€” -



All Articles