Search code examples
iosxcodeframeworkscocoapodsalamofire

Bug on Xcode 8.0, or frameworks (in red) not loading?


TL;DR: Foundation.framework appears in red afters doing pod install. That is solved by creating an iPhoneOS9.3.SDK folder on /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs but another error results from that.

I have Xcode 8.0 (8A218a) and I'm trying to use Alamofire library through Cocoapods 1.1.0.rc.2 (pre). I also had this same problem while Xcode 8 was still in Beta, and after some tries I haven't figure out how to solve it.

Basically, I successfully init and install Alamofire pod, I'm able to import Alamofire and Foundation into my project and also run it or build into my device, you can see that below: Importing

But there is this thing that bugs me off: On Pods/Frameworks/iOS the Foundation.framework file always appears in red... You can see that here: enter image description here

First of all I don't understand why it appears in red because I can import Foundation and build the app... Do you think this is a bug or is something that I need to fix?

While trying to fix it I searched about it on the internet and I've tried most common solutions like: pod update, delete all pod files and make pod install again, change Xcode developer path, update to the newest version of Xcode and Cocoapods, I even made an hard reset to my Mac but nothing seems to work...

As you can notice in the first image, when Foundation.framework is selected, we can see the path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.SDK/... By going into that directory, I could check that I don't have a folder for iPhoneOS9.3.SDK, only for iPhoneOS.sdk and iPhoneOS10.sdk, as you see below: SDKs folder

This is when I thought: I just need to duplicate the iPhoneOS10.sdk and change the name to iPhoneOS9.3.sdk. I did that and in fact when I open the project the framework is not in red anymore, you can see below. However, after doing this, I'm not able to build the app into a device anymore, I get this error: error

I feel like I've tried most of the things out there and they didn't help, I either get a red framework that allows me to build the project into my device, or a proper framework that doesn't allow me to build into my device... Do you have any idea how I can solve this, or should I just ignore it and work with Foundation.framework in red?

You can find the project here and a Gist file with the error here.

Thanks in advance!


Solution

  • Shouldn't change the name of SDK folder in any case i think,as it has a close link with IDE. I had the same problem just now.And resolved by changing the path of the 'red framework'.because the path shows 'SDK IOS9' before.So i set the framework location 'relative to SDK' and choose the right framework location manually.and it works temporarily.

    enter image description here

    I guess the reason is that i updated to Xcode 8,but my coacopods is still old version,so it set the location with IOS9 which cause this problem.