Ionic - 应用程序在启动画面上停顿

3
我的ionic应用程序停留在启动画面上 - 它以前运行良好,然后我添加了一些代码,并开始测试,但却被卡住了。
它停在这里:
------ Debug phase ------
Starting debug of 2e5ac6066864be48322a757c4d0ccdfde52cf356 (N51AP, iPhone 5s (GSM), iphoneos, arm64) a.k.a. 'Eamon White’s iPhone' connected through USB...
[  0%] Looking up developer disk image
[ 90%] Mounting developer disk image
[ 95%] Developer disk image already mounted
[100%] Connecting to remote debug server
-------------------------
(lldb) command source -s 0 '/tmp/2F06F4BB-A7E5-4B97-87EC-A01CBEE5661A/fruitstrap-lldb-prep-cmds-2e5ac6066864be48322a757c4d0ccdfde52cf356'
Executing commands in '/tmp/2F06F4BB-A7E5-4B97-87EC-A01CBEE5661A/fruitstrap-lldb-prep-cmds-2e5ac6066864be48322a757c4d0ccdfde52cf356'.
(lldb)     platform select remote-ios --sysroot '/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols'
  Platform: remote-ios
 Connected: no
  SDK Path: "/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols"
(lldb)     target create "/Users/eamonwhite/ionicmane/myapp/platforms/ios/build/device/myApp.app"
Current executable set to '/Users/eamonwhite/ionicmane/myapp/platforms/ios/build/device/myApp.app' (arm64).
(lldb)     script fruitstrap_device_app="/private/var/containers/Bundle/Application/5EBCC0EF-FDB9-4DE7-A961-D91B6139AEA0/myApp.app"
(lldb)     script fruitstrap_connect_url="connect://127.0.0.1:50188"
(lldb)     target modules search-paths add /usr "/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols/usr" /System "/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols/System" "/private/var/containers/Bundle/Application/5EBCC0EF-FDB9-4DE7-A961-D91B6139AEA0" "/Users/eamonwhite/ionicmane/myapp/platforms/ios/build/device" "/var/containers/Bundle/Application/5EBCC0EF-FDB9-4DE7-A961-D91B6139AEA0" "/Users/eamonwhite/ionicmane/myapp/platforms/ios/build/device" /Developer "/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols/Developer"
(lldb)     command script import "/tmp/2F06F4BB-A7E5-4B97-87EC-A01CBEE5661A/fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.py"
(lldb)     command script add -f fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.connect_command connect
(lldb)     command script add -s asynchronous -f fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.run_command run
(lldb)     command script add -s asynchronous -f fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.autoexit_command autoexit
(lldb)     command script add -s asynchronous -f fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.safequit_command safequit
(lldb)     connect
(lldb)     run
success
(lldb)     safequit
Process 7681 detached

deviceready消息从未出现。

我做过一件事情,可能有关系。在构建时,Ionic要求我将ios-deploy从1.9.1升级到1.9.2。我认为这是在我做完这件事之后开始发生的。我尝试回滚到1.9.1,但无法完成:

ld: framework not found MobileDevice
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **


The following build commands failed:
    Ld build/Release/ios-deploy normal x86_64
(1 failure)
npm ERR! Darwin 17.0.0
npm ERR! argv "/usr/local/Cellar/node/7.7.3/bin/node" "/usr/local/bin/npm" "install" "-g" "ios-deploy@1.9.1"
npm ERR! node v7.7.3
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE

npm ERR! ios-deploy@1.9.1 preinstall: `./src/scripts/check_reqs.js && xcodebuild`
npm ERR! Exit status 65
npm ERR! 
npm ERR! Failed at the ios-deploy@1.9.1 preinstall script './src/scripts/check_reqs.js && xcodebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ios-deploy package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ./src/scripts/check_reqs.js && xcodebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ios-deploy
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ios-deploy
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/eamonwhite/Downloads/ionicmane-master/npm-debug.log

可能那不是问题所在。我真的需要帮助,因为我临近截止日期。

更新

当我尝试在 xcode 中运行时,发生了同样的事情,但是 xcode 给出了这些错误:

2017-10-10 15:49:17.417901-0400 myApp[8476:3520766] Resetting plugins due to page load.
2017-10-10 15:49:38.433127-0400 myApp[8476:3520766] Failed to load webpage with error: The request timed out.

更新

我发现了造成这个问题的原因 - 是 livereload - 如果我不运行它,一切都没问题...但是我需要它来开发。


你所说的“卡住”是什么意思?是在启动画面后出现空白屏幕,还是一直显示加载画面?有可能提供截图吗? - Lokkesh
谢谢,无限加载启动画面 - 这只是我的启动画面,中间的加载轮一直在转动。 - ewizard
5个回答

5

我的手机没有开启wifi,所以无法连接到ionic


这是我的新问题:https://dev59.com/OaXja4cB1Zd3GeqPX-KK - ewizard
这也是我的情况。 - Jonathan

1
根据我的经验,我们遇到了相同的问题,deviceready从未在控制台日志中显示。最可能的情况是Cordova插件不一致,你可以重新安装插件并尝试删除平台文件夹,并使用npm cache clean进行清洁构建。
更新:
根据您的更新,您如何运行iOS应用程序?
您是否使用以下命令运行应用程序:-l -cionic run ios -l -c 如果是这种情况,您可能已经注意到此命令更改了config.xml文件中的一行:
// from <content src="index.html"/> // to <content src="localhost//192.1.168.0:8000" original-src="index.html"/> 因此,将其更改回<content src="index.html"/>可能会解决该问题。
解决方案2:
您可能需要以以下方式将本地主机列入白名单:
<allow-navigation href="http://localhost:8100/*"/>

谢谢,我想我已经尝试过了,我会再试一次...“重新安装”意味着删除node_modules文件夹,重新安装,然后运行platform rm/addnpm cache clean,最后运行ionic build - 此外,如果在运行npm install后仍然出现一些依赖错误,只要解决它们就可以了,对吧? - ewizard
我应该执行npm cache clean,然后再执行'platform add'吗? - ewizard
https://dev59.com/OaXja4cB1Zd3GeqPX-KK - ewizard
非常感谢您的更新,我会尝试一下。我通常使用ionic cordova run ios -lc命令(有时即使不必要也会加上--device标志)。 - ewizard
content 配置的 XML 行仍然只有 index.html,没有本地主机 IP。 - ewizard
显示剩余2条评论

0
我的最佳猜测是你的 iPhone 还没有为 iOS11 准备好调试器。当你第一次在新的 iOS 版本上运行应用程序时,它会这样做。你需要使用 XCode 打开并运行你的项目一次,然后就没问题了。请确保你拥有最新版本的 cordova-ios,即 4.5.1(检查 config.xml 中的 <engine name=ios"> 标签)。

谢谢 - 我的config.xml中没有engine标签 - 我应该添加它吗?类似于 <engine name="ios" spec="~4.4.0"/> - ewizard
当您添加iOS平台时,它应该自动添加。cordova platform add ios@4.5.1. - David

0
请检查您的config.xml文件中是否有以下标签。
<allow-navigation href="*"/>

另外,您能否检查这是否仅在iOS上观察到或也在Android上观察到。


是的,我已经检查过了,确实只是在iOS上出现问题......我目前没有安卓设备进行测试,但它在安卓模拟器中可以工作。 - ewizard

0
在Ionic 4中遇到了这个问题。添加iOS平台后,运行以下命令即可解决:
 ionic cordova prepare ios

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接