RestKit: App crashes in RKObjectRequestOperation.m on line 131 (objectRequestOpertationDidStart:)
When a user logs into my app, it does several request operations, but seems to crash when the object in the notification is ‘nil’. This is happening everytime.
RKObjectRequestOperation *objectRequestOperation = [notification object]; objc_setAssociatedObject(objectRequestOperation, RKOperationStartDate, [NSDate date], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
objectRequestOpertation is sometimes nil.
I’ve updated to the latest development branch that added the “RKManagedObjectStore_Private.h” file.
Update: The notification being sent is from initWithHTTPRequestOperation:responseDescriptors:
. WeakSelf is declared and then once it gets into the executeBlock of the stateMachine, weakSelf is nil.
It appears it is when I set the completion block and then just do [operation start]
and then leave the method it was called. Looks like my operation is being deallocated. This is happening with the 0.27.0 release as well.
This was working using 0.20.3.
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 5
- Comments: 20 (3 by maintainers)
Commits related to this issue
- Fix ResKit crash. cf. https://github.com/RestKit/RestKit/issues/2453 — committed to maxep/DiscogsAPI by maxep 8 years ago
- Merge branch 'restkit_0.27.0' into develop * restkit_0.27.0: Update Podfile to use frameworks. RestKit will no more be integrate as a static lib. Since RestKit is not compatible with Carthage, Disc... — committed to maxep/DiscogsAPI by maxep 8 years ago
- Modifying RKPaginator loadPage method. Enqueueing the request via RKObjectManager rather than using [self.objectRequestOperation start] As per: https://github.com/RestKit/RestKit/issues/2453 — committed to goldstar/RestKit by deleted user 7 years ago
- Fix ResKit crash. cf. https://github.com/RestKit/RestKit/issues/2453 — committed to nrivard/DiscogsAPI by maxep 8 years ago
- Merge branch 'restkit_0.27.0' into develop * restkit_0.27.0: Update Podfile to use frameworks. RestKit will no more be integrate as a static lib. Since RestKit is not compatible with Carthage, Disc... — committed to nrivard/DiscogsAPI by maxep 8 years ago
- Modifying RKPaginator loadPage method. Enqueueing the request via RKObjectManager rather than using [self.objectRequestOperation start] As per: https://github.com/RestKit/RestKit/issues/2453 — committed to goldstar/RestKit by deleted user 7 years ago
- - https://github.com/RestKit/RestKit/issues/2453 — committed to SiarheiMinkin/RestKit by siarheiMinkinCogniteq 4 years ago
Hi guy. Any news about this?
I’ve the same problem: IOS: 9.3.4 XCode: 7.3.1 Restkit: 0.27
Note: if i enqueue the operation it runs well. “[[RKObjectManager sharedManager] enqueueObjectRequestOperation:postOperation];”
Replace
[[NSNotificationCenter defaultCenter] postNotificationName:RKObjectRequestOperationDidStartNotification object:weakSelf];
To[[NSNotificationCenter defaultCenter] postNotificationName:RKObjectRequestOperationDidStartNotification object:self];
Worked for me
Same crash here. iOS 10 XCode 8 RestKit 0.27.0 Seems like the operation is not retained, so it dies right after
[operation start];
If I add operation to NSOperationQueue, it works ok.@lazar-sidor I followed @silvaigor answer and it solved it
Use [[RKObjectManager sharedManager] enqueueObjectRequestOperation:operation]; Insted of [operation start];