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

流过昼夜 提交于 2020-01-05 04:37:08

问题


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.



来源:https://stackoverflow.com/questions/26283724/cant-build-in-xcode-6-arc-issues-in-apple-frameworks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!