iOS   发布时间:2022-05-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – NSInternalInconsistencyException:未实现loadSourceForBridge时,bundleURL必须为非nil大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我最近开始在使用react-native构建的iOS移动应用程序中收到此错误(下面的详细错误).只有当我尝试使用选项2在手机上运行应用程序时才会发生这种情况,即使用静态软件包加载.我试过了: >在xcode中清理和重建 >重置缓存并运行react packager >在手机上卸载应用程序 >来自Windows背景,我也尝试重启我的机器 Xcode出错 2016-08-04 09:34:37.611
我最近开始在使用react-native构建的iOS移动应用程序中收到此错误(下面的详细错误).只有当我尝试使用选项2在手机上运行应用程序时才会发生这种情况,即使用静态软件包加载.我试过了

>在Xcode中清理和重建
>重置缓存并运行react packager
>在手机上卸载应用程序
>来自Windows背景,我也尝试重启我的机器

Xcode出错

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)

我可以看到这个问题在代码中打印了here,但我最初是本机iOS开发中的初学者,不知道如何解决这个问题.

请帮我解决这个问题.谢谢!

AppDelegate.swift文件中的代码

/**
 * 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")

正如您所看到的,我已经注释掉了选项1并且没有注释掉“选项2”.我在设备上以这种方式运行相同的应用程序,如100次.我没有对代码进行任何更改,但突然间我开始看到上面的错误.

解决方法

只是为我添加一个快速的“doh”时刻.如果您在模拟器中运行并获得此功能,请确保在运行应用程序时包管理器正在运行.如果不是,它可能会抱怨这一点.

大佬总结

以上是大佬教程为你收集整理的ios – NSInternalInconsistencyException:未实现loadSourceForBridge时,bundleURL必须为非nil全部内容,希望文章能够帮你解决ios – NSInternalInconsistencyException:未实现loadSourceForBridge时,bundleURL必须为非nil所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。