2013-04-09 27 views
10

我使用Safari瀏覽器的遠程調試在我的模擬器的iPhone應用程序檢查網頁視圖。問題是遠程調試窗口一旦應用程序關閉。保持Safari瀏覽器遠程調試開放的導航

我有一個切換到另一個應用程序和背部的動作,但因爲我不夠快,我不能在切換之前讀取立即執行console.log消息和回來後,我無法讀取立即日誌我的應用程序,因爲我必須先重新打開控制檯。

有沒有一種方法,以保持打開狀態,所以我至少可以看到最後的日誌從切換應用?

+2

這是一個重大的煩惱,如何努力將它是讓審查員打開並保持與模擬器的連接活着?來吧蘋果! – James 2013-04-25 20:56:54

+1

對於那些不處理切換應用程序,但有類似的問題,我得到了里程發出'location.reload()'在控制檯 – pgorsira 2015-02-10 09:08:29

回答

2

這裏是啓動Safari瀏覽器檢查一個AppleScript。您可以將其導出爲可執行應用程序,並讓它坐在碼頭中,只需單擊一下即可進入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 
+0

優秀的!今天你需要使用「iOS模擬器」而不是「iPad ..」。 – viksit 2014-12-15 22:21:52

1

這是詹姆斯的回答包裹在Alfred Workflow,-G- ...檢查

也適用於IPHONE布拉赫

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 
相關問題