XCode:调试 =>“模拟位置”菜单项不可用(变灰)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24951590/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 05:16:22  来源:igfitidea点击:

XCode: Debug => "Simulate Location" menu item not available (greyed out)

xcodedebugginggeolocation

提问by Fabio Napodano

I cannot seem to add any simulated location to the simulator, as the corresponding menu is completely greyed out, as shown in figure:

我好像不能在模拟器中添加任何模拟位置,因为对应的菜单完全变灰了,如图:

enter image description here

在此处输入图片说明

the location works well when debugging with the actual device.

使用实际设备进行调试时,该位置运行良好。

any idea?

任何的想法?

回答by Ben Thielker

The iOS Simulator must be running your app before that menu will be enabled. For me it appears immediately after a successful build.

在启用该菜单之前,iOS 模拟器必须运行您的应用程序。对我来说,它在成功构建后立即出现。

If it's proving inconvenient to make a selection in that menu between build of your app and it's launch, I would recommend setting a default location via Product -> Scheme -> Edit Scheme. You can then select your preferred default in the Run / Options panel after checking the "Allow Location Simulation" box.

如果事实证明在应用程序构建和启动之间在该菜单中进行选择不方便,我建议通过产品 -> 方案 -> 编辑方案设置默认位置。选中“允许位置模拟”框后,您可以在“运行/选项”面板中选择首选默认值。

Xcode : Default location option

Xcode:默认位置选项