Re: ARC issue
Re: ARC issue
- Subject: Re: ARC issue
- From: Marco Tabini <email@hidden>
- Date: Wed, 07 Nov 2012 08:18:40 -0500
I wonder if the problem might be that data is an autoreleased object, which automatically gets dealloc'ed at the end of the autorelease pool (as explained in the docs). Have you tried replacing
*error = data
with
*error = [data copy]
and seeing what happens?
On 2012-11-07, at 8:05 AM, Andreas Grosam <email@hidden> wrote:
> NSDictionary* fetchUser(NSNumber* ID, NSError** error)
> {
> id user = nil;
> //@autoreleasepool // crashes when @autoreleasepool is enabled
> {
> id data = ...; // response body of a HTTP Response (NSData) or NSError object, never nil.
> if ([data isKindOfClass:[NSData class]]) {
> user = [NSJSONSerialization JSONObjectWithData:data
> options:0
> error:error];
> }
> else if (error) {
> *error = data;
> }
> } // autoreleasepool
> return user;
> }
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >ARC issue (From: Andreas Grosam <email@hidden>) |