From 1355cf040abde2a27537e0d5abba3fb819c547ab Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Tue, 30 Mar 2021 12:26:01 +0200 Subject: [PATCH 1/4] Enabled StoreKit Testing in Xcode --- .../ios/Runner.xcodeproj/project.pbxproj | 21 +--- .../contents.xcworkspacedata | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 3 + .../example/ios/Runner/Configuration.storekit | 96 +++++++++++++++++++ 4 files changed, 102 insertions(+), 20 deletions(-) create mode 100644 packages/in_app_purchase/in_app_purchase/example/ios/Runner/Configuration.storekit diff --git a/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/project.pbxproj b/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/project.pbxproj index 95b145bc544b..3821ea2f0ddd 100644 --- a/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/project.pbxproj @@ -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 = ""; }; 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 = ""; }; 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 = ""; }; F78AF3132342BC89008449C7 /* PaymentQueueTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PaymentQueueTest.m; path = ../../../ios/Tests/PaymentQueueTest.m; sourceTree = ""; }; /* End PBXFileReference section */ @@ -155,6 +156,7 @@ 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + F6E5D5F926131C4800C68BED /* Configuration.storekit */, ); path = Runner; sourceTree = ""; @@ -205,7 +207,6 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - AC81012709A36415AE0CF8C4 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -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 */ diff --git a/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a16ed0f..919434a6254f 100644 --- a/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index e1fad2d518ae..a02e5381b602 100644 --- a/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -69,6 +69,9 @@ ReferencedContainer = "container:Runner.xcodeproj"> + + Date: Tue, 30 Mar 2021 18:54:22 +0200 Subject: [PATCH 2/4] Updated documentation --- .../in_app_purchase/in_app_purchase/CHANGELOG.md | 4 ++++ .../in_app_purchase/example/README.md | 14 ++++++++++++++ .../in_app_purchase/in_app_purchase/pubspec.yaml | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md index beb4356dc398..e3434d4d7118 100644 --- a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md @@ -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. diff --git a/packages/in_app_purchase/in_app_purchase/example/README.md b/packages/in_app_purchase/in_app_purchase/example/README.md index 4140483cd1ca..2ab8eea99020 100644 --- a/packages/in_app_purchase/in_app_purchase/example/README.md +++ b/packages/in_app_purchase/in_app_purchase/example/README.md @@ -60,6 +60,20 @@ below. ### iOS +When using Xcode 12 and iOS 14 or higher you can run the example in the simulator or real 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. Select the device you want to run the example App on; + +3. Run the application using `Product > Run` (or hit the run button). + +When testing on pre-iOS 14 you will need to take the following steps: + 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 diff --git a/packages/in_app_purchase/in_app_purchase/pubspec.yaml b/packages/in_app_purchase/in_app_purchase/pubspec.yaml index 5a0a3ba565ed..6dfb805d6245 100644 --- a/packages/in_app_purchase/in_app_purchase/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase/pubspec.yaml @@ -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: From 0f70f40194485d01f33e4d71f1d2e26ac5adc6e9 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Wed, 31 Mar 2021 14:34:03 +0200 Subject: [PATCH 3/4] Updated README --- packages/in_app_purchase/in_app_purchase/example/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase/example/README.md b/packages/in_app_purchase/in_app_purchase/example/README.md index 2ab8eea99020..679eda20edbf 100644 --- a/packages/in_app_purchase/in_app_purchase/example/README.md +++ b/packages/in_app_purchase/in_app_purchase/example/README.md @@ -60,10 +60,9 @@ below. ### iOS -When using Xcode 12 and iOS 14 or higher you can run the example in the simulator or real 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)). +When using Xcode 12 and iOS 14 or higher you can run the example in the simulator 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`; From 237d984093209c9ac9d115acb001758ef6402844 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Wed, 7 Apr 2021 15:27:17 +0200 Subject: [PATCH 4/4] Disable StoreKit testing by default --- .../in_app_purchase/example/README.md | 19 ++++++++++++++----- .../xcshareddata/xcschemes/Runner.xcscheme | 3 --- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase/example/README.md b/packages/in_app_purchase/in_app_purchase/example/README.md index 679eda20edbf..dc59c6e92ba7 100644 --- a/packages/in_app_purchase/in_app_purchase/example/README.md +++ b/packages/in_app_purchase/in_app_purchase/example/README.md @@ -60,18 +60,27 @@ below. ### iOS -When using Xcode 12 and iOS 14 or higher you can run the example in the simulator without having to -configure an App in App Store Connect. The example app is set up to use StoreKit Testing configured +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. Select the device you want to run the example App on; +2. Within Xcode edit the current scheme, `Product > Scheme > Edit Scheme...` (or press `Command + Shift + ,`); -3. Run the application using `Product > Run` (or hit the run button). +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. -When testing on pre-iOS 14 you will need to take the following steps: +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 diff --git a/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a02e5381b602..e1fad2d518ae 100644 --- a/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/in_app_purchase/in_app_purchase/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -69,9 +69,6 @@ ReferencedContainer = "container:Runner.xcodeproj"> - -