In app purchases fails in production app - iphone

I have developed a game which is free but offers In app purchases. This worked perfectly fine whilst in testing but since the game has been released (first initial release) attempting to purchase any IAPs results in a crash. I used the Ray Wenderlich IAP tutorial as a base for this code.
When running on a simulator the - didFailWithError handler is hit when trying to get the product list, the error has an error code of 2. I cant even get to the point of testing the IAP with the simulator.
When running the actual production app (from the store) on my phone the crash log states the following:
0 CoreFoundation 0x2e9cfe8b 0x2e8fb000 + 872075
1 libobjc.A.dylib 0x38ccd6c7 objc_exception_throw + 38
2 CoreFoundation 0x2e9cfdcd 0x2e8fb000 + 871885
3 StoreKit 0x310e69d9 0x310e4000 + 10713
4 60 Seconds 0x000b77df -[IAPHelper buyProduct:] (IAPHelper.m:53)
5 60 Seconds 0x000b7091 -[UpgradeViewController Buy5000Squares] (UpgradeViewController.m:199)
6 UIKit 0x3118a55f 0x3114a000 + 263519
So I know it receives the product list correctly, and when double checking against ITC the names are correct (in fact I know they are because I always populate my internal product codes with what the store sends me)
So the real question is what is going on? Why is it crashing and why does my simulator not even let me try to test this?
Some helpful bits of code
-(void)Buy5000Squares
{
if (![SKPaymentQueue canMakePayments])
{
// show alert box
return;
}
[[SecondsIAPHelper sharedInstance] buyProduct:squares5000Product];
}
- (void)buyProduct:(SKProduct *)product {
NSLog(#"Buying %#...", product.productIdentifier);
SKPayment * payment = [SKPayment paymentWithProduct:product];
[[SKPaymentQueue defaultQueue] addPayment:payment];
}
Edit
Turns out that according to this question / answer XCode 5 prevents testing of in app purchases in the simulator (I developed this on the GM of XCode 5 so surprised this is the case) but it offers an explanation at least for that part. Still unsure why it wouldnt work on my device though

It turns out the issue was because I hadnt signed my IAP contracts / banking / tax information properly in iTunes connect. I had previously only created paid apps so hadn't set up this information.
Once I had signed these correctly it started to work after 12-24 hours

Related

Content push for Newsstand in iOS 7.1 to change magazine cover suddenly not working in existing Newsstand App

We noticed that the silent content push messages that we are sending to update the magazine cover of our Newsstand App suddenly stopped working specifically in iOS 7.1.
I just did some testing sending the content push to the following devices:
iOS-5.1.1 -> push received -> magazine cover updated -> OK
iOS-7.0.6 -> push received -> magazine cover updated -> OK
iOS-7.1 -> push never received -> NOK
However, if I send a push alert message to these devices, all alert messages are correctly received and shown, so I am sure that I am using the correct device tokens.
And this issue is on an existing App live in the App store, never having this issue before and it seems to be specific to iOS 7.1.
This is the content push message we are sending:
$payload = '{
"aps" :
{
"content-available" : 1,
}
}';
Anybody else having the same problems specific in iOS 7.1?
Thx!
I am having that issue also on 7.1 in development. If connected to XCODE we see the method application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler invoked... ONCE we disconnect from Xcode... that method does NOT get called based on reviewing the console.
EDIT :: Today during testing against the sandbox environment with a iPhone on iOS7 7.1 (11D167) the content-available starting working ?? We are getting calls into didReceiveRemoteNotification fetchCompletionHandler: NOW, even when phone is NOT connected to XCode or anything. Even if the Phone is Locked and Application is in the background... which is what we needed and very important.
Really odd... but we did find that the Manual Do Not Disturb was ON.. on this test phone.. not sure how that got on and if that was issue. Make sure that is NOT ON.. otherwise you will not get any remoteNotification calls into your application. We may have gotten off track with the other postings that content-available was broken on ios7.1.
If anyone knows anything else about this, please share.
From https://support.magplus.com/entries/84992596-About-Lower-Issue-Download-Counts-Since-iOS-7:
About Lower Issue Download Counts Since iOS 7
With the release of iOS 7, Apple changed the way Newsstand Push Notifications work, and it is a significant departure from how Newsstand Push Notifications were delivered with iOS 5 and iOS 6. With iOS 7, Apple attempted to change the way these notifications worked, primarily optimizing the mechanism for apps that receive e-mail and Twitter updates and notifications multiple times within a 24-hour period. Part of the problem with iOS 7 is that it is not clearly differentiating Newsstand Push Notifications (which initiate a background download of content) from standard Push Notifications (which just deliver text).
A key change in iOS 7 is that if an app is killed manually by the end user, then the app simply does not receive Newsstand Push Notifications to automatically download new content in the background. Users manually kill an app by bringing up a screen of currently running apps and swiping one up to force it to quit. Apple views this scenario as one where the end user has made a conscious decision that they do not want the app running/performing background operations which consume battery life.
The two unique features of Newsstand Apps as promoted by Apple self in 2011, 2012 and 2013 (in WWDC video's about newsstand) were:
A - background download of new Magazines and
B - changing the cover when a new Magazine is available and showing a badge.
Unfortunately, in the real world situation, since iOS 7, Apple has killed both these features. Content push messages needed for these two features don't work if the user has killed the Newsstand App. Which in real world situation will almost always be the case.
Suppose you have a Magazine that appears monthly. How big is te chance that the user will have your Newsstand App running all the time in the background? I think almost none...
Before iOS 7, this user could be notified via a content push message resulting in a badge and a new cover visible in the Newsstand.
Since iOS7, these features are gone in real world situations.
Result: much lower magazine views and downloads.
Thanks Apple!

ChartBoost not Showing Interstitial

I have followed example from Chartboost i iOS. Even I have checkout all the Questions from Stackoverflow too. I have used their suggestions too, but not found Interstitials.
Even I have allow publish in network in Chartboost dashboard.
It works fine for the Firsttime when App is Installed on device and even if we delete the app and run xcode still the same issue that Chartboost not showing Interstitial. Every time it calls method as follows:
- (void)didFailToLoadInterstitial:(NSString *)location
I have also included below method:
- (void)didDismissInterstitial:(NSString *)location {
NSLog(#"chartboost*** dismissed interstitial at location %#", location);
[[Chartboost sharedChartboost] cacheInterstitial:location];
}
I haven't seen the Chartboost Ad in my App. I have also included the Method as follow to check whether Caching is available or not.
BOOL isCached = [[Chartboost sharedChartboost] hasCachedInterstitial:#"After level 1"];
and returns NO. In two screens I need Advertisement from chartboost. And I have given them two different Location Names too and calls them whenever needed.
How to overcome from this issue??
It's been 2 years so you already know the solution to your questions but for those who face this issue, you have to wait a few minutes sometimes even over 10 minutes for the 1st interstitial chartboost to show up whether live or test ad. When you delete your app and re-run it again on Xcode you have to wait again a long time. Sometimes longer than 10 minutes.

MKStoreKit Buy Feature does nothing

I'm trying to get the MKStoreKit working with my Cocos2D game. It look pretty simple to do and I've followed all the steps a couple of times (to check I've done it correctly) but I still can't get it to work. I can retrieve a product name, price and description etc. but I can use the shared MKStoreKitManager to make a purchase.
Here's my code for buying a product:
if([MKStoreManager isFeaturePurchased: #"com.testing.iap.removeAds"]) {
NSLog(#"No ads");
}else{
NSLog(#"Ads");
NSLog(#"Buying feature...");
[[MKStoreManager sharedManager] buyFeature: #"com.testing.iap.removeAds"
onComplete:^(NSString* purchasedFeature)
{
NSLog(#"Purchased: %#", purchasedFeature);
// provide your product to the user here.
// if it's a subscription, allow user to use now.
// remembering this purchase is taken care of by MKStoreKit.
}
onCancelled:^
{
NSLog(#"Something went wrong");
// User cancels the transaction, you can log this using any analytics software like Flurry.
}];
}
Basically if the product hasn't been previously purchased, kick off the purchase process. The problem is nothing happens! I don't even get the onCancelled being called and there are no error messages apart from the one's I can ignore (i.e. iCloud support and custom server options).
Can anyone shed some light on what it is thats stopping me?
Note: I'm testing on an iPhone 4 device running iOS 5.1
As soon as your app launches, call:
[MKStoreManager sharedManager];
That's it. As long as you call the -buyFeature: method after the products have been downloaded (you could observe kProductFetchedNotification if you want) everything works as expected.
I have no idea what wasn't working but after spending al most a full working day trying to get this to work I decided to start a new project from scratch and try again. I done everything exactly the same and it all worked!
Make sure you added your IAP key to the MKStoreKitConfigs.plist. Without that it does nothing.
Also it can take a few hours until a register IAP becomes available for testing.

iAd not give any ad [duplicate]

I'm adding iAd to my app. Now, in simulator, it works well but when I load it on a device (v4.1) the ADBannerViewDelegate calls bannerView:didFailToReceiveAdWithError: with this description on the error.userInfo
{
ADInternalErrorCode = 3;
NSLocalizedFailureReason = "Ad inventory unavailable";
}
I think my iAd Network setup is correct. Have I to add an ad by myself or iAd Network automatically sends test ads as in simulator?
EDIT: I think it was a latency problem of the iAd Network server that dispatches the ads. I suppose that when the network had ads for my app it began to work fine.
if you running with a development certificate you will only get test ads even when running on a device. From the iAd Programming Guide:
While you are developing your
application, iAd Network sends test
advertisements to your application. To
assist you in validating your
implementation, the iAd Network
occasionally returns errors to test
your error handling code. You can also
test your error handling support by
turning your device’s wireless
capability off.
So you should see the test Ad on the device but you will never see a real live ad.
Yes, Removing app from device and rebuilding solved it in my case.
It was a latency problem of the iAd Network server that dispatches the ads. I suppose that when the network had ads for my app it began to work fine.
After this did not work for me, deleting the app from the device and doing a clean build did.
Just an additional update, running ad testing on my IPAD I got this error suddently, after banging my head (as others have done) for a while I noticed the time on the IPAD was 8 mins out, both were set on auto but still 8 mins difference, set the IPAD clock manually and error went away!.
Hope this helps someone.
According to the ADBannerView class reference of Apple's documantation iOS Developer Library:
enum {
ADErrorUnknown = 0,
ADErrorServerFailure = 1,
ADErrorLoadingThrottled = 2,
ADErrorInventoryUnavailable = 3,
ADErrorConfigurationError = 4,
ADErrorBannerVisibleWithoutContent = 5,
ADErrorApplicationInactive = 6
};
typedef NSUInteger ADError;
//ADErrorInventoryUnavailable
//Indicates that no advertisements are currently available to download.
//Available in iOS 4.0 and later.
//Declared in ADBannerView.h.
Therefore it is an exception caused by the server side of the iAd; not the code itself.
For the last 5 days I've been having the same issue. I was getting a valid response before that and the bannerViewDidLoadAd delegate method was been called. Maybe there is something on apple's side? I didn't find anything that implies that, but it's my guess

the game is not recognized by game center

Hi
I am trying to add game center to my iphone app.
I have done the following steps
1) I have added an app to my itnuesAccount
2) I assigned the Bundle ID as net.myCompany.myGameCenter
3) I am using the same "net.myCompany.myGameCenter" as Bundle identifier in my info.plist
4) using the sample code provided by apple i added the authentication steps.
self.currentLeaderBoard= kEasyLeaderboardID;
self.currentScore= 0;
[super viewDidLoad];
if([GameCenterManager isGameCenterAvailable])
{
self.gameCenterManager= [[[GameCenterManager alloc] init] autorelease];
[self.gameCenterManager setDelegate: self];
[self.gameCenterManager authenticateLocalUser];
[self updateCurrentScore];
}
else
{
[self showAlertWithTitle: #"Game Center Support Required!"
message: #"The current device does not support Game Center, which this sample requires."];
}
I have tried putting the kEasyLeaderboardID value equal to the one that i placed myself upon creating the new leader board.
I tried the other one, that i defined at step2. "myComap"
Other people who are stuck with this problem to this date, like me..
Turned out because my devices were jailbroken =/ .. I read an answer somewhere on stackoverflow.com that jailbroken devices interpret the app as a "real-world" app, thus not discovering sandbox accounts ..
I restored my iPad, and got an iPod touch from a friend, and both worked painlessly .. (previously, I tried it on 3 jailbroken devices, for which none of them worked ..).
Ah my bad
the BundleId at the iTunes connect and the one in the info.plist have to be same
and the leaderboardID is used for for submitting and viewing the score.
Many reasons are there for this problem
Add your app on itunesconnect.apple.com
Fill all information (Make Sure your available/publish date)
Can enter dummy data, but bundle id and name must be original as your real game.(Can't change)
then put your leaderboard/Achivement id in your app.
If still you getting same message "Game Center is not recognized this game", check your availability date which you have enter while filling the information of your app on itunesconnect.apple.com. This date should not be after your current date.
If again you are getting same problem then upload this app on AppStore. (After checking you can reject this uploaded binary)
Well, I tried every tips but still got this warning!!
Finally, I solved it by creating a new App on iTunes Connect!! After you've added a new App for your project, you need to press "Manage Game Center" and choose a group. Then your game will be recognized by the game center, even you haven't added 'Leaderboards' or 'Achievements'.
Gah! This was driving me crazy. I had done everything right, had all the correct bundleIDs, certificates, etc., my app is already in the app store, but I was still getting this message. (iOS9.x, XCode 7.1)
Turns out that adding a single achievement in iTunesConnect made things work. I suspect I could have added a leaderboard, instead.
Basically, the message can also mean "while your app says it's Game Center capable, it doesn't actually have any GC content" and adding an achievement or leaderboard makes the game "recognized" by GC.
Seems on iOS 8 GameCenter sandbox is disabled by default. I met a similar problem and solved by enabling Game Center sandbox in Settings and re-logining.