Question

My Xcode project imported MKStoreKit. And I followed to this. http://blog.mugunthkumar.com/coding/using-mkstorekit-in-your-apps/ But it has many error.

SFHFKeychainUtils.m ,ARC Casting Rules ,Semantic issue ,ARC Restrictions

Total 39 bugs.

I linked StoreKit.framework,Security.framework.

-I write this Initialize code in application didFinishLaunchingWithOptions. Initialize code is [MKStoreManager sharedManager];

However Bugs appears. Why?

Was it helpful?

Solution

You need to disable ARC on all of the MKStoreKit files—including JSONKit, SFHFKeychainUtils, and NSData+Base64. Details are in this post

Disable Automatic Reference Counting for Some Files

Then comment out all of the the error message lines

/*
#if ! __has_feature(objc_arc)
#error MKStoreKit is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
#endif
*/

That gets rid of all but one error in this method. But he just forgot to declare it in the .h

+(id) receiptForKey:(NSString*) key {

  NSData *receipt = [MKStoreManager objectForKey:key];
  if(!receipt)
    receipt = [MKStoreManager objectForKey:[NSString stringWithFormat:@"%@-receipt", key]];

  return receipt;               
}

Add this line in your .h

+(id) objectForKey:(NSString*) key;

The code will now compile. Don't know if it works, but at least it compiles.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top