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 <agro...@onlinehome.de> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to