Strange compiler error during ShareKit integration

一笑奈何 提交于 2019-12-11 02:47:56

问题


I tried integrate ShareKit in my project and I face a problem.

By the time I include the ShareKit classes in my classes project folder the compiler gets errors like

"Parse Issue. Unknown type name 'NSUInteger'" or "Parse Issue. Unknown type name 'NSString'"

in the MyProject_Prefix.pch file.

The variables I defined in the prefix file are globally used by my application. I have never got this kind of error before untill I included the ShareKit classes in my project.

Thanks in advance.


回答1:


I managed to solve this issue by moving all #import declarations and any other Objective-c code inside the #ifdef __OBJC__ section.

So for example, if your pch file looks like this, it will cause compilation errors:

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
#endif
#import <CoreData/CoreData.h>
typedef void (^BasicBlock)();

It must look like this, and those errors should go away:

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
    #import <CoreData/CoreData.h>
    typedef void (^BasicBlock)();
#endif


来源:https://stackoverflow.com/questions/9824754/strange-compiler-error-during-sharekit-integration

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