Can't Build in Xcode 6 - ARC Issues in Apple F

2019-08-02 21:24发布

问题:

Upon updating to Xcode 6, I can no longer build my app. Xcode is throwing errors and warnings like the following:

Error:

/Applications/Xcode-6.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectContext.h:121:5: Pointer to non-const type 'id' with no explicit ownership

Warning:

/Applications/Xcode-6.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:206:4: warning: '__strong' only applies to Objective-C object or block pointer types; type here is 'const char *' [-Wignored-attributes]

The error is in CoreData.framework, the warning is in Foundation.framework.

Here's a link to my build log: http://pastebin.com/RCgV8Pj1

I've tried deleting and re-adding my frameworks using both drag and drop from the Frameworks directory, and the add button in Project->Build Phases. Neither fixes the error. I also tried deleting the SharedPrecompiledHeaders directory. I also saw this, but his fix doesn't work for me. I have no "Frameworks" directory in my project. I even went as far as re-installing Xcode 6.

I assume this is an error with a build setting someplace, but I don't know what would have changed or what I should update. Initially after using Xcode 6 I couldn't build in Xcode 5 either, but I reverted my xcodeproj and it works fine in the older version.

回答1:

Make sure you don't have a Frameworks path in your FRAMEWORK_SEARCH_PATHS in project settings or target settings, as it can cause headers to be read from both iPhoneOS.platform and iPhoneSimulator.platform, causing warnings during compilation and errors during linking.

The problem can arise spontaneously if you add/change frameworks in your project and once Xcode's caches have been rebuilt, you also lose the ability to compile backups of your project because the bug is at the Xcode level.

See:

My answer in '__strong' only applies to objective-c object or block pointer types; type here is XXX" warning



回答2:

This appears to have been fixed by upgrading to OS X 10.10 GM and reinstalling Xcode 6. Not sure which one actually allowed the project to build.

[UPDATE]This didn't permanently fix the issue. It came back after about 5 days.