Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[in_app_purchase] Configured example app to use StoreKit Testing on iOS 14 #3772

Merged
merged 4 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/in_app_purchase/in_app_purchase/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.1+3

* Configured the iOS example App to make use of StoreKit Testing on iOS 14 and higher.

## 0.5.1+2

* Update README to provide a better instruction of the plugin.
Expand Down
22 changes: 22 additions & 0 deletions packages/in_app_purchase/in_app_purchase/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,28 @@ below.

### iOS

When using Xcode 12 and iOS 14 or higher you can run the example in the simulator or on a device without
having to configure an App in App Store Connect. The example app is set up to use StoreKit Testing configured
in the `example/ios/Runner/Configuration.storekit` file (as documented in the article [Setting Up StoreKit Testing in Xcode](https://developer.apple.com/documentation/xcode/setting_up_storekit_testing_in_xcode?language=objc)).
To run the application take the following steps (note that it will only work when running from Xcode):

1. Open the example app with Xcode, `File > Open File` `example/ios/Runner.xcworkspace`;

2. Within Xcode edit the current scheme, `Product > Scheme > Edit Scheme...` (or press `Command + Shift + ,`);

3. Enable StoreKit testing:
a. Select the `Run` action;
b. Click `Options` in the action settings;
c. Select the `Configuration.storekit` for the StoreKit Configuration option.

4. Click the `Close` button to close the scheme editor;

5. Select the device you want to run the example App on;

6. Run the application using `Product > Run` (or hit the run button).

When testing on pre-iOS 14 you can't run the example app on a simulator and you will need to configure an app in App Store Connect. You can do so by following the steps below:

1. Follow ["Workflow for configuring in-app
purchases"](https://help.apple.com/app-store-connect/#/devb57be10e7), a
detailed guide on all the steps needed to enable IAPs for an app. Complete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
CC2B3FFB29B2574DEDD718A6 /* Pods-in_app_purchase_pluginTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-in_app_purchase_pluginTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-in_app_purchase_pluginTests/Pods-in_app_purchase_pluginTests.debug.xcconfig"; sourceTree = "<group>"; };
DE7EEEE26E27ACC04BA9951D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
E20838C66ABCD8667B0BB95D /* libPods-in_app_purchase_pluginTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-in_app_purchase_pluginTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
F6E5D5F926131C4800C68BED /* Configuration.storekit */ = {isa = PBXFileReference; lastKnownFileType = text; path = Configuration.storekit; sourceTree = "<group>"; };
F78AF3132342BC89008449C7 /* PaymentQueueTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PaymentQueueTest.m; path = ../../../ios/Tests/PaymentQueueTest.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -155,6 +156,7 @@
97C146F11CF9000F007C117D /* Supporting Files */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
F6E5D5F926131C4800C68BED /* Configuration.storekit */,
);
path = Runner;
sourceTree = "<group>";
Expand Down Expand Up @@ -205,7 +207,6 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
AC81012709A36415AE0CF8C4 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -369,24 +370,6 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
AC81012709A36415AE0CF8C4 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"products" : [
{
"displayPrice" : "0.99",
"familyShareable" : false,
"internalID" : "AE10D05D",
"localizations" : [
{
"description" : "A consumable product.",
"displayName" : "Consumable",
"locale" : "en_US"
}
],
"productID" : "consumable",
"referenceName" : "consumable",
"type" : "Consumable"
},
{
"displayPrice" : "10.99",
"familyShareable" : false,
"internalID" : "FABCF067",
"localizations" : [
{
"description" : "An non-consumable product.",
"displayName" : "Upgrade",
"locale" : "en_US"
}
],
"productID" : "upgrade",
"referenceName" : "upgrade",
"type" : "NonConsumable"
}
],
"settings" : {

},
"subscriptionGroups" : [
{
"id" : "D0FEE8D8",
"localizations" : [

],
"name" : "Example Subscriptions",
"subscriptions" : [
{
"adHocOffers" : [

],
"displayPrice" : "3.99",
"familyShareable" : false,
"groupNumber" : 1,
"internalID" : "922EB597",
"introductoryOffer" : null,
"localizations" : [
{
"description" : "A lower level subscription.",
"displayName" : "Subscription Silver",
"locale" : "en_US"
}
],
"productID" : "subscription_silver",
"recurringSubscriptionPeriod" : "P1M",
"referenceName" : "subscription_silver",
"subscriptionGroupID" : "D0FEE8D8",
"type" : "RecurringSubscription"
},
{
"adHocOffers" : [

],
"displayPrice" : "5.99",
"familyShareable" : false,
"groupNumber" : 2,
"internalID" : "0BC7FF5E",
"introductoryOffer" : null,
"localizations" : [
{
"description" : "A higher level subscription.",
"displayName" : "Subscription Gold",
"locale" : "en_US"
}
],
"productID" : "subscription_gold",
"recurringSubscriptionPeriod" : "P1M",
"referenceName" : "subscription_gold",
"subscriptionGroupID" : "D0FEE8D8",
"type" : "RecurringSubscription"
}
]
}
],
"version" : {
"major" : 1,
"minor" : 0
}
}
2 changes: 1 addition & 1 deletion packages/in_app_purchase/in_app_purchase/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: in_app_purchase
description: A Flutter plugin for in-app purchases. Exposes APIs for making in-app purchases through the App Store and Google Play.
homepage: https://github.com/flutter/plugins/tree/master/packages/in_app_purchase
version: 0.5.1+2
version: 0.5.1+3

dependencies:
flutter:
Expand Down