Check subscription status in iOS app Ionic 2 - ios

I am currently developing an in-app purchasing in Ionic 2 and each time the app is run I check if a user is subscribed. For Android I use restorePurchases function. For iOS I am trying to use getReceipt() function. What I get is a long Base64 receipt string.
My question is, how am I supposed to check if a subscription exists using that string?
Thank you in advance.

I am answering the implicit question of why this error could occur:
Many things can go wrong causing this error, which most of them has nothing to do with your code actually. just your setup. for this to work in a test device
You should be logged in that device using a iTunes Connect sandbox
account.
You should be logged in your Mac using sandbox account. (not sure why, but I read somewhere you have to, and I do it!)
The Bundle ID everywhere should match. that is in your iTunes Connect, your ionic app's Config.xml
should not have production version of the app on your device
hope others provide better answering explaining why this is so difficult to get to work!

Related

Touch ID not showing StoreKit

I'm using StoreKit for processing In-App purchases, which works perfectly.
My only issue which I couldn't find a solution online is:
In other apps when trying to do an IAP, I'm asked for Touch ID (so it's not my device set up wrong or so) while in my App it always asks for password.
How can I get Touch ID to work for authentication with iTunes?
Thank you in advance!
Alright,
So I'm not sure if this is always the case but in the AppStore version of my App you can actually use Touch ID.
Maybe Touch ID is just not supported when developing... Still a bit confusing that they have you release your App without being sure if Touch ID is going to work :/

iOS Switching from paid to free app, how does one know who previously purchased the app?

I have a paid app that was released on iOS 4. It hasn't been updated and I'm now reworking it to work with iOS 10. Since in app purchasing was not a thing, I made a free (lite) and paid version of the app. I would like to update the paid version to iOS 10 and change it from paid to free with ads and an in app purchase to remove ads.
I tried researching various methods and I have not found a fool proof way or evidence that one will work in all cases. The two most prevelant methods I found:
Use an existing UserDefaults key value to determine if they opened the old app and then grant them no ads in the new version.
I don't think this method will work, as if the app was uninstalled or the user redownloads it after the update they would not have that value.
I believe iOS 7 offered receipt checking. Use receipt checking to determine if the user has paid for the app and check if the date is before the new version date.
I'm not sure if this would work either. I saw in the documentation to verify locally. Would everything I need exist if the app was an iOS 4 app originally? Would this work for users who had the app through a promo code? What if they don't have an internet connection at the time they open the app? I had trouble finding sample code for this option to test.
How would I go about doing this? Are any of the methods above the only way or are there others?
Out of all the resources I found on this subject, checking the receipt seems to be your only feasible choice. If you have an account where you purchased your app, you can run the new version of the app via Xcode with that account and see if the receipt validation gives you the expected information. Though installing the app via Xcode may alter the receipt that the account has, you may want to check on that.
NSUserDefaults option could work if you were setting any value to NSUserDefaults on the iOS 4 version.

iOS In-app purchase nightmare

We are developing an App with Ionic and cordova-plugin-inapppurchase. We've been struggling more than a week as we get the following error when we try to restore a purchase:
RMStore: unknown product id com.company.appname.myID
{"errorMessage":"Unknown product identifier","errorCode":100}
productId = 'com.company.appname.myID';
This post is old, but I was able to fix this problem for myself tonight. Using Ionic v1 with the cordova-plugin-inapppurchase, my solution was to change com.company.appname.myID to just myID (the product id of the in app purchase).
I also had a few other problems causing the same exact error message. The main one was needing to inAppPurchase.getProducts(productIds) before attempting inAppPurchase.buy(productId). Also, make sure you're testing on a real device, with a test account created on iTunes connect, and logged out of any other apple ids on your device (I signed out through the iTunes Store app).
Good luck future readers!

iOS simulator build for Facebook app approval crashes

I have done everything specified by Facebook. I even validated the sim build using the ios-sim tools and it runs fine on my Mac. There are no crashes. Has anyone had this problem before? What am I missing. here is a screenshot :
Edit I gave it another try and I got the same results. Even for the Android build. I was thinking tht maybe i sent them a zip by mistake but this time I double checked that I'm sending them a link to a .apk file to download from Mega.nz. Testing the iOS sim build on my end yields nothing since the game runs fine. I'm in dire need of some sage advice from someone who has gone trough this process. Here is another screenshot from todays rejection.
In my case I just set the app in facebook to be active for the public. This allowed my users to log in and share post, from the app to facebook. I'm Only missing the publish_actions permission. Just get your app approved on the app store and send facebook the link for that. Simulation builds just dont work for them
Dude I never tried it before but I read somewhere that if you are getting trouble to get approved by selecting iOS on submitting you can select Android as platform on submission and after approved your facebook integrations will be working fine for iOS apps too.
Doesn't cost too much to have a try ;)

In-app payment still says it's in sandbox mode

I built a in-app payment for one of my iPhone apps. It worked in sandbox mode.
I submitted my app to the app store and it got accepted. I even submit my in app payment. It got accepted and it's status is 'ready for sale'.
However, when I go get my app in the app store, it still says it's in sandbox?
Is there something in MKStoreKit that you have to transfer environments, or does it take some time for it to change?
I currently pulled it from the store because of it. Please help! Thanks.
Hmmm. Are you using your Test User ID or a real Apple ID?
When this happens, it's usually because you previously used the same device for testing IAP in sandbox mode. To fix, just go into "Settings", then go to "Store", then log out and back in again. That should clear that up, assuming that you are actually using the archived app that you downloaded from iTunes, rather than your dev copy.
Re-released my app today so I could get it and see if the in app payment would work. Surprisingly, it worked and it wasn't in sandbox mode! So I guess it just takes time for apple's servers to make the change.
If anyone else had this problem, don't fret like I did! Just wait and be patient. Hold for developer release and wait around 24 hours and you should be good!
Here's the real solution (edit):
Set your availability date to the future so it will be removed from the app store
Set your availability date to the day it is so it will re appear

Resources