网络连接用http就報錯,必須用https

chrome:
GET http://localhost:8080/api/game/test net::ERR_CONNECTION_REFUSED
模拟器:
Simulator: Response failed, error buffer: 无法连接到服务器。

我用https就沒事,怎樣可以不須用https

Info.plist文件要配置,这是苹果的要求要使用https。
添加NSAllowsArbitraryLoads为YES表示允许http。

好像設了,還是不行
Info.plist的路徑是不是 Application>CocosCreator>Contents>Resources>cocos2d-x>simulator>contents>Info.plist?

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

剛試了下websocket也是不行,服務器接收到了,但chrome彈錯誤:sob::sob::sob::sob::sob:

NSAppTransportSecurity

NSAllowsArbitraryLoads

原來要設置成false!!!:joy: 被他玩殘了

官方文档里的websocket
ws = new WebSocket(“ws://echo.websocket.org”);
连var也少了
这文档真是不可靠!!!