RestKit: RestKit doesnt build in version 0.26

Maybe this is my problem, as I would assume its working for some people.

I have updated to 0.26 today, I am using use_frameworks! in my Podfile (cocoapods 0.39)

It fails in CoreData.h on #import <RestKit/CoreData/RKEntityMapping.h> with file not found

I have tried cleaning, removing Pods/, no luck getting this to build.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 115 (48 by maintainers)

Commits related to this issue

Most upvoted comments

If anyone is having problems with RestKit 0.26.0 and Cocoapods 1.0.1, hopefully this will help!

This solution worked at least on 2016-06-03, but since it uses specific git branches maybe these will be merged, so if this does not work for you please check if this git branches have been merged/moved/deleted.

Clean up before everything

Quit Xcode

rm -rf Pods
rm -rf MyApp.xcworkspace  
rm -rf ~/Library/Caches/CocoaPods
rm -rf ~/Library/Developer/Xcode/DerivedData

Use mcfedr’s RestKit fork

Must be used together with “reachablility” branch of AFNetworking

pod 'AFNetworking', :git => 'https://github.com/mcfedr/AFNetworking.git', :branch => 'reachability'
pod 'RestKit', :git => 'https://github.com/mcfedr/RestKit.git', :branch => 'pods1'

Use module import syntax in Bridging Header (Swift only)

@import RestKit;

Now it should work!

Why is this closed? Is this being tracked elsewhere? @Sajjon Seems to have a solution that can be absorbed and released to the public so we don’t have to use a fork. I understand this may require coordination with AFNetworking team. Just curious as RestKit is used by so many and everyone has been dealing with this issue for some time now. Thank you all for you efforts to resolve. 😃

I have made branches of both RestKit and AFNetworking that solve these problems

pod 'RestKit', :git => 'https://github.com/mcfedr/RestKit.git', :branch => 'reachability'
pod 'AFNetworking', :git => 'https://github.com/mcfedr/AFNetworking.git', :branch => 'reachability'

I have just removed the conditions for #ifdef _SYSTEMCONFIGURATION_H and everything works just fine.

My fork, https://github.com/mcfedr/RestKit/tree/pods1 works with cocoapods v1.

pod 'RestKit', :git => 'https://github.com/mcfedr/RestKit', :branch => 'pods1'

@mcfedr’s solution works – can we just merge it and cut a new release? A lot of people has been having this problem and it’s been a problem for 6 months now.

Yes try 0.27 then hopefully everything will work out 😃

@Sajjon @valeriomazzeo I am using Xcode 7.3, and looks like the RestKit version is ‘RestKit’, ‘~> 0.24.1’. Do I need to upgrade?

I think the easier thing to do at the moment it would be to add a cocoapods post install script to the pod file that modifies the umbrella header when installing restkit.

This way we don’t depend from external branches / fork and we have a full working installation hoping that we either remove the whole AFNetworking dependency one day, or cocoapods fix it somehow.

I have created an issue: https://github.com/CocoaPods/CocoaPods/issues/5390

@mcfedr It crashes on line 131 of RKRequestOperation.m with EXC_BAD_ACCESS. Maybe this is because of some other changes made on the development branch.

- (void)objectRequestOperationDidStart:(NSNotification *)notification
{
    RKObjectRequestOperation *objectRequestOperation = [notification object];

    //crashes here because objectRequestOperation is nil
    objc_setAssociatedObject(objectRequestOperation, RKOperationStartDate, [NSDate date], OBJC_ASSOCIATION_RETAIN_NONATOMIC);

    NSURLRequest *request = objectRequestOperation.HTTPRequestOperation.request;
    RKLogInfo(@"%@ '%@'", request.HTTPMethod, request.URL.absoluteString);
    RKLogDebug(@"request.headers=%@", request.allHTTPHeaderFields);
    if (request.HTTPBody && RKLogIsTrace()) {
        RKLogTrace(@"request.body=%@", RKLogTruncateString([[NSString alloc] initWithData:request.HTTPBody encoding:NSUTF8StringEncoding]));
    }
}

changing line 322 to not use weak reference solves the crash problem but not sure if this is the right thing to do

//__weak __typeof(self)weakSelf = self;
self.stateMachine = [[RKOperationStateMachine alloc] initWithOperation:self dispatchQueue:[[self class] dispatchQueue]];
[self.stateMachine setExecutionBlock:^{
    [[NSNotificationCenter defaultCenter] postNotificationName:RKObjectRequestOperationDidStartNotification object:self];
    RKIncrementNetworkActivityIndicator();
    if (self.isCancelled) {
        [self.stateMachine finish];
    } else {
        [self execute];
    }
}];