Xcode 6 - Unknown type name 'NSString' / E

2019-04-06 07:15发布

When I am running my project in Xcode 6, I am having many weird errors.

Parse Issue - Unknown type name 'NSString'
Format argument not an NSString
Could not build module Foundation
Could not build module QuartzCore

All of these errors occur in Apple's header files such as: CAMediaTiming.h, NSObjCRuntime.h,NSZone.h,NSObject.h, CALayer.h, etc.

Unfortunately, the answers in here: ios - Parse Issues in NSObjCRuntime, NSZone, and NSObject did not work for me.

How do you recommend I fix these errors?

5条回答
冷血范
2楼-- · 2019-04-06 07:37

You can get this error if you have a PrefixHeader file that imports Objective-C code and also some plain C files in your project, because the C files try to import the Objective-C.

To fix, wrap your objective-c imports like this :

#ifdef __OBJC__
#import <OOObjectiveCClass.h>
#endif
查看更多
Luminary・发光体
3楼-- · 2019-04-06 07:47

You can also try deleting the Samples folder in the FacebookSDK folder (and then deleting the reference to it in Xcode.

查看更多
beautiful°
4楼-- · 2019-04-06 07:52

I use Xcode 8.3.3,I also encounter this problem,and I solve this issue by selecting the file and in the right panel in Xcode in the Identity and Type part choose Type to Objective-C++.

查看更多
霸刀☆藐视天下
5楼-- · 2019-04-06 07:54

See if the Prefix Header file path is correctly placed under Build Settings tab. See the complete answer at the following link.

Check this post

查看更多
SAY GOODBYE
6楼-- · 2019-04-06 07:59

The problem was that I had some .c files in my project, apparently Xcode 6 doesn't like .c files.

I changed the extension of the .c files to .m and Xcode 6 is happy again!

查看更多
登录 后发表回答