我的Xcode项目导入了MKStoreKit。然后我就找到了这个。http://blog.mugunthkumar.com/coding/using-mkstorekit-in-your-apps/,但是它有很多错误。
SFHFKeychainUtils.m,ARC转换规则,语义问题,ARC限制
总共39个bug。
我链接了StoreKit.framework,Security.framework。
-I在应用程序didFinishLaunchingWithOptions中编写此初始化代码。初始化代码为MKStoreManager sharedManager;
但是会出现Bugs。为什么?
发布于 2012-05-23 22:53:52
您需要在所有MKStoreKit文件上禁用ARC -包括JSONKit、SFHFKeychainUtils和NSData+Base64。详情请看这篇文章
Disable Automatic Reference Counting for Some Files
然后注释掉所有错误消息行
/*
#if ! __has_feature(objc_arc)
#error MKStoreKit is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
#endif
*/这就消除了这个方法中除一个错误之外的所有错误。但他只是忘了在.h中声明它
+(id) receiptForKey:(NSString*) key {
NSData *receipt = [MKStoreManager objectForKey:key];
if(!receipt)
receipt = [MKStoreManager objectForKey:[NSString stringWithFormat:@"%@-receipt", key]];
return receipt;
}将此行添加到您的.h中
+(id) objectForKey:(NSString*) key;代码现在将进行编译。不知道它能不能工作,但至少它能编译。
https://stackoverflow.com/questions/10459658
复制相似问题