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.
3.参考:
> 注:本文首发于 [iHTCboy's blog](http://iHTCboy.com),如若转载,请注来源