如何在 iOS 模拟器中调试失败的命令行应用程序启动

问题描述 投票:0回答:0

我正在尝试在 Xcode 之外使用我自己的构建系统构建应用程序。我已经在我的 macOS 笔记本电脑 (x86) 和 iOS 设备 (ARM) 上运行了一些东西,但我还没有在 iOS 模拟器中运行我的应用程序。返回的错误无济于事,我想知道是否有人知道如何找出问题所在。

我使用模拟器 SDK (

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk
) 为我的主机架构 (x86_64) 编译了应用程序。接下来我运行这些 shell 命令:

# Starts the simulator
% open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app

# Install app on the simulator
% xcrun simctl install booted build/HelloWorldIOS/Hello.app

# Try to launch it
% xcrun simctl launch booted com.example.HelloWorldIOS --console -w 
             
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=3):
Simulator device returned an error for the requested operation.
No such process
Underlying error (domain=NSPOSIXErrorDomain, code=3):
    Application launch for 'com.example.HelloWorldIOS' did not return a valid pid nor a launch error.
    No such process

应用程序图标扩展为黑屏片刻,所以我知道它正在尝试启动它。然后它就消失了。

我在 Console.app 中找不到任何有用的东西。很多这样有用的消息:

Bootstrapping failed for <FBApplicationProcess: 0x7fb57d670960; application<com.example.HelloWorldIOS>:<invalid>> with error: <NSError: 0x60000033e820; domain: RBSRequestErrorDomain; code: 5; reason: "Launch failed."> {
    NSUnderlyingError = <NSError: 0x60000033f330; domain: NSPOSIXErrorDomain; code: 162>;
}

我的

main()
函数的第一行尝试写入 stdout 和 stderr,所以要么它没有到达那里,要么
--console
没有按照我的想法去做。

ios build ios-simulator simctl
© www.soinside.com 2019 - 2024. All rights reserved.