在使用Xcode模拟器时,无法模拟器无法处理网络请求,即使首次安装应用时,手动调用网络。
这也就导致,无法在Xcode模拟器中获取到StoreKit 2的商品价格和信息。
经过查询相关贴文,了解到问题存在于iOS 18.4版本的模拟器中。
解决方案为,将Xcode模拟器降级使用18.2或者17以前的版本,或者升级到18.5以后的版本。
参考文章
1、fetch [TypeError: Network request failed] on iOS 18.4:https://github.com/facebook/react-native/issues/50510
2、API network request error on iOS device, not simulator:https://stackoverflow.com/questions/62492694/api-network-request-error-on-ios-device-not-simulator
3、Swift应用启动时弹出网络请求:https://fangjunyu.com/2024/10/23/swift%e5%ba%94%e7%94%a8%e5%90%af%e5%8a%a8%e6%97%b6%e5%bc%b9%e5%87%ba%e7%bd%91%e7%bb%9c%e8%af%b7%e6%b1%82/