【问题标题】:Keep safari remote debugging open on navigation在导航时保持 Safari 远程调试打开
【发布时间】:2013-03-31 07:44:32
【问题描述】:

我正在使用 Safari 的远程调试来检查我模拟器中 iPhone 应用程序中的 web 视图。问题是远程调试窗口会在应用程序关闭时立即关闭。

我有一个动作可以切换到另一个应用程序并返回,但我无法在切换之前立即读取 console.log 消息,因为我不够快,并且在返回到我的应用程序后我无法立即读取日志应用程序,因为我必须先重新打开控制台。

有没有办法让它保持打开状态,这样我至少可以看到切换应用之前的最后日志?

【问题讨论】:

  • 这是一个主要的烦恼,让检查器保持打开状态并保持与模拟器的连接有多难?苹果加油!
  • 对于那些不处理切换应用程序但有类似问题的人,我可以通过在控制台中发出 location.reload() 获得里程

标签: safari ios-simulator remote-debugging


【解决方案1】:

这是一个启动 Safari Inspector 的 AppleScript。您可以将其导出为可执行应用程序,然后将其放在您的 Dock 中,只需单击一下即可进入 Inspector,或者在 Xcode 的构建阶段启动它。

tell application "Safari"
    activate
    delay 2
    tell application "System Events"
        tell process "Safari"
            set frontmost to true
            click menu item 2 of menu 1 of menu item "iPad Simulator" of menu 1 of menu bar item "Develop" of menu bar 1
        end tell
    end tell
end tell

【讨论】:

  • 太棒了!今天你需要使用“iOS Simulator”而不是“iPad..”。
【解决方案2】:

这是 James 的答案,包裹在 Alfred Workflow, -g- ... 检查一下

也适用于 IPHONE BRAH

on alfred_script(q)
tell application "Safari"
    activate
    delay 0.5
    tell application "System Events"
        tell process "Safari"
            set frontmost to true
            try
                click menu item 2 of menu 1 of menu item "iPhone Simulator" of menu 1 of menu bar item "Develop" of menu bar 1
            end try
            try
                click menu item 2 of menu 1 of menu item "iPad Simulator" of menu 1 of menu bar item "Develop" of menu bar 1
            end try
        end tell
    end tell
end tell
end alfred_script

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-11
    • 2019-05-06
    • 2015-11-05
    • 1970-01-01
    • 2021-04-27
    • 1970-01-01
    • 1970-01-01
    • 2021-10-07
    相关资源
    最近更新 更多