1.出現情況
在設置里登陸沙盒賬號提示:
不允許創建 iTunes 賬戶
此 Apple ID 目前無法用于 iTunes Store, 請稍后重試
正確方式:
沙盒測試賬號只能在測試應用點擊儲值時,彈窗中輸入賬號,不能在設置里的 App Store 里添加。
蘋果的文檔也有說明,測試賬號不能在設置里登陸 :
Important: Don’t enter your test account information in the Store settings panel. Doing so may invalidate your test account.
2. 正確的沙盒測試流程
To perform testing for in-app purchase products
Set up test user accounts within Users and Roles in iTunes Connect, as detailed in Creating Sandbox Tester Accounts in iTunes Connect Developer Guide.
You’ll need a test user for each territory you want to test the app in.Clear any account information stored on your test device.
- In Settings, go to the Store settings.
- Click the Sign Out button.
This prevents an actual user account from automatically being used when testing.Important: Don’t enter your test account information in the Store settings panel. Doing so may invalidate your test account.
- Connect your test device to your Mac.
- In Xcode, set your test device as your scheme’s destination.
- Open your app, and perform your in-app purchase product testing.
- Use your test account credentials to test the purchase.
When your app uses the Store Kit API to request a payment, you’re asked to sign in. Select Use Existing Account and enter your test account user name and password. You are then asked to confirm the purchase. The transaction completes.
No financial transaction takes place, but a receipt is generated for a successful transaction.
參考:
注:本文首發于 iHTCboy's blog,如若轉載,請注明來源。