Created
September 18, 2012 19:13
-
-
Save badeen/3745177 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#0 0x32a10960 in objc_exception_throw () | |
#1 0x3604bb3c in _PFFaultHandlerLookupRow () | |
#2 0x3604d0fe in _PF_FulfillDeferredFault () | |
#3 0x36054c10 in _PF_ManagedObject_WillChangeValueForKeyIndex () | |
#4 0x3605f332 in _sharedIMPL_setvfk_core () | |
#5 0x0009c4f2 in __block_global_0 at /Users/Jonathan/Projects/matchbox_ios/matchbox/matchbox/MBUser.m:60 | |
#6 0x36068bc0 in developerSubmittedBlockToNSManagedObjectContextPerform () | |
#7 0x333f04b6 in _dispatch_client_callout () | |
#8 0x333f51bc in _dispatch_main_queue_callback_4CF$VARIANT$mp () | |
#9 0x346d3f3a in __CFRunLoopRun () | |
#10 0x34646ebc in CFRunLoopRunSpecific () | |
#11 0x34646d48 in CFRunLoopRunInMode () | |
#12 0x34b832ea in GSEventRunModal () | |
#13 0x35a25300 in UIApplicationMain () | |
#14 0x00060cc4 in main at /Users/Jonathan/Projects/matchbox_ios/matchbox/matchbox/main.m:16 | |
- (void)awakeFromFetch | |
{ | |
[super awakeFromFetch]; | |
if (![self.hasImage boolValue]) { | |
NSManagedObjectID *moID = self.objectID; | |
NSManagedObjectContext *ctx = self.managedObjectContext; | |
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:[self URLForRemoteImage]]; | |
AFImageRequestOperation *op = [AFImageRequestOperation imageRequestOperationWithRequest:req success:^(UIImage *image) { | |
[ctx performBlock:^{ | |
MBUser *user = (MBUser *)[ctx objectWithID:moID]; | |
if (!user.isDeleted) { | |
user.image = UIImagePNGRepresentation(image); // <--- Crashes here | |
user.hasImage = @YES; | |
[[MBMatchboxAPI sharedMatchboxAPI] saveContext]; | |
} | |
}]; | |
}]; | |
[[MBMatchboxAPI sharedMatchboxAPI].imageHTTPClient enqueueHTTPRequestOperation:op]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment