问题
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