本来我以为是项目本身有什么问题,安卓是好的,然后我打了ios的项目,本来是想预览一下ios的项目
结果报错
NSURLConnection finished with error - code -1002
Response failed, error buffer: unsupported URL
JS: [ERROR]: Failed to load scene: Error: [AssetLibrary] loading JSON or dependencies failed: undefined
XMLHttpRequest_finalize, 0x7fae00417e50 …
开始我以为是我项目出现了什么问题,于是网上找了很久资料,看到stackoverflow中一个方法,设置环境变量CFNETWORK_DIAGNOSTICS=1 让xcode把错误的url打出来,结果我看到了如下信息:
[ERROR] Failed to invoke require, location: /Volumes/other/Project/iosClient/jsb-default/frameworks/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_global.cpp:292
glGetIntegerv: pname: 0x8b4c
In the constructor of HttpClient!
2019-05-03 00:17:58.137636+0800 Client-mobile[17157:455574] CFNetwork Diagnostics [1:1] 00:17:58.134 {
LoaderWhatToDo: (null)
Request: <CFURL 0x60000151c050 [0x10f401ae8]>{string = res/import/18/18a85650-0207-4983-9c22-21a18117addb.70e1b.json, encoding = 134217984, base = (null)}
CachePolicy: 1
WhatToDo: originload
CreateToNow: 0.00708s
} [1:1]
看起来是某个资源加载失败,就表现上来看,确实最后报出了JS: [ERROR]: Failed to load scene: Error: [AssetLibrary] loading JSON or dependencies failed: undefined
由于确实没有什么头绪,网上查了1002的错误,说是url错误,我就想是不是资源载入的url有啥问题,于是,我新建了一个示例项目,示例项目应该没问题吧?可惜的是结果一样,这我就没啥头绪了,请原谅我的菜,因为刚开始接触打原生包,确实很多东西没头绪,说下我的环境吧,cocos是2.0.9,xcode是10.2.1,不知你们有没有遇到类似的问题,如何解决的?
在此万分感谢回答的各位