Restkit has suddenly stopped compiling today

2019-07-05 05:31发布

问题:

I am using RestKit in my project since a long time, using CocoaPods.

Podfile:pod 'RestKit', '~> 0.26.0'

Today, for unknown reasons, my project doesn't compile anymore. To the best of my knowledge, i have not changed any project settings or anything.

I get the error in RKObjectManager.h:

/projects/iphone/Pods/Headers/Public/RestKit/Network/RKObjectManager.h:892:49: 
Unknown type name 'AFNetworkReachabilityStatus'; did you mean 'SCNetworkReachabilityFlags'?

If i go into the h.file and click on the ReachabilityStatusEnum, i can see it, so it seems to be there although it says 'Unknown Type'.

I am at a loss as to how fix this. I followed the RestKit cocoapods instructions when i set it up a long time ago. Could it be because i upgraded xcode recently?

Very thankful for pointers...

回答1:

This seems to be an issue with RestKit and cocoapods 1.0.1 (maybe also 1.0). What I did was install version 0.39 which I had used before.

sudo gem install cocoapods -v 0.39.0

and then use this Version to install

pod _0.39.0_ install

solved the problem for me at least for the time being.



回答2:

OK, so in the end, i had to add this to the .pch file. I have never had it there, and my project has built for over a year without it. Would be great to know why i suddenly had to include it...

#if __IPHONE_OS_VERSION_MIN_REQUIRED
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
#else
#import <SystemConfiguration/SystemConfiguration.h>
#import <CoreServices/CoreServices.h>
#endif


回答3:

Had the same issue. You should use pre 1.0 versions of CocoaPods. If you have already the newer version installed pod --version do the following steps:

  1. Install 0.39.0 version of CocoaPods sudo gem install cocoapods -v 0.39.0
  2. Setup it with pod _0.39.0_ setup
  3. Check whether it worked well with pod _0.39.0_ --version

You should see 0.39.0.

NOTE: in certain cases you will see that the version of pod _0.39.0_ --version is still the same newer version that you are trying to override. In this case you have to use - sudo gem uninstall cocoapods, then from the menu you will see in Terminal uninstall the newer version and finally get pod _0.39.0_ --version returning you exactly 0.39.0.

Now you can run pod install as usual.

Do not forget to switch back to the actual version later :)