且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是否可以在iOS中同时自动执行两个应用程序?

更新时间:2023-10-16 10:13:58

对于iOS,您可以启动SMS应用程序,并在该应用程序中执行所需的任何操作.例如,您可以打开SMS应用程序,然后打开最新消息,然后单击(或复制)链接.

For iOS you can bring up the SMS app and do whatever you like within the app. For example, you could open SMS app, then open the latest message and then click (or copy) the link.

我用红宝石.我使用基于XCUITest驱动程序的方法(已经被Noyo链接了) 可以使用的方法如下:

I use ruby. I use methods based on XCUITest driver (that Noyo linked already) Methods that can be used are the following:

启动设备上安装的任何应用程序的方法:

Method for launching any app installed on device:

def launch_system_app(bundle_id)
  @driver.execute_script('mobile: launchApp', {'bundleId': "#{bundle_id}"});
end

终止已启动应用程序的方法:

Method for terminating the launched app:

def terminate_system_app(bundle_id)
  @driver.execute_script('mobile: terminateApp', {'bundleId': "#{bundle_id}"});
end

将给定字符串复制到iOS设备剪贴板的方法:

Method for copying given string to iOS device clipboard:

def set_pasteboard(content)
  @driver.set_clipboard(content: content)
end

使用消息"应用程序包ID进行呼叫:

Call using Messages app bundle id:

launch_system_app("com.apple.MobileSMS")
terminate_system_app("com.apple.MobileSMS")