• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ARC issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: ARC issue
      • From: Ken Thomases <email@hidden>
References: 
 >ARC issue (From: Andreas Grosam <email@hidden>)

  • Prev by Date: ARC issue
  • Next by Date: Re: ARC issue
  • Previous by thread: ARC issue
  • Next by thread: Re: ARC issue
  • Index(es):
    • Date
    • Thread