我最近在使用react-native
构建的iOS移动应用中遇到此错误(下面的详细错误)。这种情况只有在我尝试使用Option 2
在手机上运行应用时才会发生,而2016-08-04 09:34:37.611 GalarmApp[367:165469] *** Assertion failure in
-[RCTBatchedBridge loadSource:](), /Users/abc/Projects/GalarmApp/node_modules/react-native/React/Base/RCTBatchedBridge.m:180 2016-08-04 09:34:37.613 GalarmApp[367:165469] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'bundleURL must be non-nil when not implementing loadSourceForBridge'
*** First throw call stack: (0x182b32db0 0x182197f80 0x182b32c80 0x1834b81c0 0x1000af788 0x1000adefc 0x1000adca4 0x1000e73d8 0x1000e7368 0x1000e6700 0x1000e643c 0x10005a254 0x10003cebc 0x10003c214 0x10003966c 0x100039b18 0x187d069c0 0x187f36184 0x187f3a5f0 0x187f37764 0x1844d37ac 0x1844d3618 0x1844d39c8 0x182ae909c 0x182ae8b30 0x182ae6830 0x182a10c50 0x187cff94c 0x187cfa088 0x10003bee0 0x1825ae8b8) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
是使用静态捆绑加载的。我试过了:
Xcode错误
/**
* Loading JavaScript code - uncomment the one you want.
*
* OPTION 1
* Load from development server. Start the server from the repository root:
*
* $ npm start
*
* To run on device, change `localhost` to the IP address of your computer
* (you can get this by typing `ifconfig` into the terminal and selecting the
* `inet` value under `en0:`) and make sure your computer and iOS device are
* on the same Wi-Fi network.
*/
// let jsCodeLocation = NSURL(string: "http://localhost:8081/index.ios.bundle?platform=ios&dev=true")
/**
* OPTION 2
* Load from pre-bundled file on disk. The static bundle is automatically
* generated by "Bundle React Native code and images" build step.
*/
let jsCodeLocation = NSBundle.mainBundle().URLForResource("main", withExtension: "jsbundle")
我可以看到这个问题在代码中打印here,但我最初是本机iOS开发的初学者,不知道如何解决这个问题。
请帮我解决这个问题。谢谢!
AppDelegate.swift文件中的代码
Option 1
如您所见,我已注释掉from flask import Flask, render_template, json, Request
app = Flask(__name__)
@app.route('/main')
def main():
return render_template('index.html')
@app.route('/showSignUp')
def showSignUp():
return render_template('signup.html')
@app.route('/signUp',methods=['POST'])
def signUp():
_name = Request.form['inputName']
_email = Request.form['inputEmail']
_password = Request.form['inputPassword']
if _name and _email and _password:
return json.dumps({'html':'<span>All fields good !!</span>'})
else:
return json.dumps({'html:':'<span>Enter the required fields</span>'})
if __name__ == "__main__":
app.run(debug=True)
并取消注释了“选项2”。我在设备上以这种方式运行相同的应用程序,如100次。我没有对代码进行任何更改,但突然间我开始看到上面的错误。
答案 0 :(得分:3)
只需添加一个快速的&#34; doh&#34;对我而言。如果您在模拟器中运行并获得此功能,请确保在运行应用时程序包管理器正在运行。如果不是,它可能会抱怨这一点。
答案 1 :(得分:1)
如果您没有正确签署应用程序,也可能会出现此错误。检查Xcode设置和警告
答案 2 :(得分:0)
对于我的情况,我打开我的Mac上的Web代理设置,这会导致问题。关闭Web代理设置可以解决我的问题。