简体   繁体   English

从iOS Simulator应用程序打开Finder窗口路径

[英]Open Finder window path from iOS Simulator app

During development of a feature in our app, for testing purposes I need to edit a file that is within the app bundle during runtime. 在开发应用程序功能期间,出于测试目的,我需要在运行时编辑应用程序捆绑包中的文件。 It is a pain to enter the bundle path into the Finder "Go to" menu each time and open it. 每次都将捆绑包路径输入到Finder的“转到”菜单中并打开它是很痛苦的。

Is there a way in my code to open a Finder window with a path, even if it is using a private API (this app is just for testing)? 我的代码中是否有一种方法可以打开带有路径的Finder窗口,即使它使用的是专用API(此应用仅用于测试)?

NSString *bundlePath = [[NSBundle mainBundle] resourcePath];

// Open bundlePath in Finder

I think that you can use a macOS application that is downe here, than you can archive and install as app on your mac, and than whenever you want you can navigate easily on simulator files. 我认为您可以使用此处提供的macOS应用程序,可以在Mac上作为应用程序存档和安装,也可以在任何需要的地方轻松浏览模拟器文件。

Here is repo. 这是回购。 https://github.com/dsmelov/simsim https://github.com/dsmelov/simsim

Hope that will help you. 希望对您有所帮助。

Alternate solution: Open terminal. 替代解决方案:打开终端。

print: NSLog(@"open %@", [[NSBundle mainBundle] resourcePath]) and copy/paste into the terminal. 打印: NSLog(@"open %@", [[NSBundle mainBundle] resourcePath])然后复制/粘贴到终端中。 the open command on OS X does the same thing as clicking on that path in finder. OS X上的open命令与在finder中单击该路径具有相同的作用。 so just print the path to your resource. 因此只需打印资源的路径即可。

I don't think you're likely to find a direct solution because any api that interacts nicely with os x for this type of thing will not compile for armv7,arm64 (because its x64 only of course) and even though those archetectures aren't needed for the simulator, they are listed in the architectures section of the projects 'Build Settings' and messing with those arch/compile/linker settings is almost certainly more trouble than it would be worth. 我认为您不太可能找到直接的解决方案,因为与os x进行良好交互的任何api都不会针对armv7,arm64进行编译(当然,仅因为其x64),即使这些架构都不是。如果需要模拟器,则将它们列在“构建设置”项目的architectures部分中,并且弄乱那些arch / compile / linker设置几乎肯定比它值得的麻烦更多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM