-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[in_app_purchase] Configured example app to use StoreKit Testing on iOS 14 #3772
Conversation
<StoreKitConfigurationFileReference | ||
identifier = "../Runner/Configuration.storekit"> | ||
</StoreKitConfigurationFileReference> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmagman We discovered that this setting doesn't seem to be picked up when running the app with flutter run
. It is only affective when running the app through xcode.
Do you have any idea why would that be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started the example app from Android Studio (run not debug). I guess the --debug
makes the difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should work in release, too. Looks like it doesn't work on a real device though, I had only tried on the simulator. In the device logs I see:
default 12:50:08.880522-0700 appstored appstored StoreKit com.apple.appstored StoreKitServiceConnection(1084): Loading 4 products for io.flutter.plugins.inAppPurchaseExample
default 12:50:08.971100-0700 appstored appstored StoreKit com.apple.appstored StoreKitServiceConnection(1084): Returning 0 products, 4 invalid identifiers for io.flutter.plugins.inAppPurchaseExample
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I will look into it again. I was also running on a simulator.
I did notice that if I run it first with Xcode and afterwards from Android Studio it worked fine. However if I start a fresh simulator (which didn't have the app installed) and run it with Android Studio I run into some exceptions.
It is kinda late over here so I will do some more testing tomorrow and if I run into issues I will make a detailed report.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm it's weird, if I run it once from Xcode it works, and then subsequently from the command line it also works, so Xcode is laying something else down. The bundles look identical. The entitlements are the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes indeed, Xcode is doing some magic regarding the Configuration.storekit
file in my opinion. I followed the Setting Up StoreKit Testing in Xcode article which describe to enable StoreKit Testing in Xcode through the following steps:
- Click the scheme to open the scheme menu; choose Edit Scheme.
- In the scheme editor, choose the Run action.
- Click Options in the action settings.
- For the StoreKit Configuration option, select a configuration file.
I have the feeling that Xcode somehow parses the Configuration.storekit
and registers the products configured in the file separate from the App on the simulator (some form of offline StoreKit cache). If you make changes to the Configuration.storekit
file and run the App using flutter run
the changes are not reflected in the App it self. If you run the App using Xcode the changes are correctly reflected in the App.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good. Let's wait for Jenn to see if there's a way to make flutter run
work.
33e3df2
to
5c49896
Compare
cff3296
to
237d984
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! The storekit testing doesn't seem to be working in command line, which will delay our plan to make XCUITests for IAP. However, this PR is a big improvement for the example app and there's no regression, so we should land it!
StoreKit is for testing with the data that is configured locally. How to test with the consumables created on app store connect using simulator ? |
Unfortunately you can't. If you want to test your consumables configured in the AppStore you will have to test on a real device. |
@mvanbeusekom Maybe we should add this information in our docs too? |
* master: (397 commits) [in_app_purchase] Implementation of platform interface (flutter#3781) [google_sign_in] Add todo WRT correctly setting X-Goog-AuthUser header (flutter#3819) [tools] fix version check command not working for new packages (flutter#3818) [camera] android-rework part 1: Base classes to support Android Camera features (flutter#3795) fix MD (flutter#3815) Path provider windows crash fix (flutter#3814) [local_auth] docs update (flutter#3103) Update PULL_REQUEST_TEMPLATE.md (flutter#3801) [quick_actions] handle cold start on iOS correctly (flutter#3811) Replace path_provider_linux widget tests with simple unit tests (flutter#3812) [sensors] format dart code based on the new dart formatter (flutter#3809) [google_sign_in] Fix "pick account" on iOS (flutter#3805) [image_picker_platform_interface] Added pickMultiImage (flutter#3782) [in_app_purchase] Added currency code and numerical price to product detail model. (flutter#3794) [local_auth] Fix iOS crash when no localizedReason (flutter#3780) Fix and update version checks (flutter#3792) [in_app_purchase] Configured example app to use StoreKit Testing on iOS 14 (flutter#3772) [local_auth] Unnecessary reassignment in example removed (flutter#2983) [flutter_webview] Fix `allowsInlineMediaPlayback` ignored on iOS (flutter#3791) Switch script/tools over to the new analysis options (flutter#3777) ...
Is there any additional information on this? It does appear StoreKit testing will work using Android Studio, only after executed from Xcode one time. Is this the assumed workaround, or will a fix be implemented to initially work from Android Studio? |
@sneglia9191 can you file a new issue describing what you're seeing? I'm unfamiliar with that problem. |
Configured example app to use StoreKit Testing on iOS 14 and higher.
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
[shared_preferences]
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.