iPhone模拟器启动时自动打开Safari Debugger
发布时间:2020-12-15 01:54:43 所属栏目:百科 来源:网络整理
导读:Safari中的iOS网页调试器是蜜蜂的膝盖,但每次重启模拟器时都会关闭。每次构建后,不仅可以从菜单中重新打开它,而且还可以调试启动过程中发生的任何行为。 有没有办法在Xcode中设置一个触发器,以便在每次构建之后自动打开Safari调试器,或者可能是构建shel
Safari中的iOS网页调试器是蜜蜂的膝盖,但每次重启模拟器时都会关闭。每次构建后,不仅可以从菜单中重新打开它,而且还可以调试启动过程中发生的任何行为。
有没有办法在Xcode中设置一个触发器,以便在每次构建之后自动打开Safari调试器,或者可能是构建shell脚本或Automator操作来构建并立即打开调试器的方法? 解决方法
这是一个部分解决方案。这将打开一个Safari的调试窗口,这是一个很好的,但不是自动的。
在Mac上打开脚本编辑器(命令空间栏并键入脚本编辑器) 粘贴在此代码中: -- `menu_click`,by Jacob Rus,September 2006 -- -- Accepts a list of form: `{"Finder","View","Arrange By","Date"}` -- Execute the specified menu item. In this case,assuming the Finder -- is the active application,arranging the frontmost folder by date. on menu_click(mList) local appName,topMenu,r -- Validate our input if mList's length < 3 then error "Menu list is not long enough" -- Set these variables for clarity and brevity later on set {appName,topMenu} to (items 1 through 2 of mList) set r to (items 3 through (mList's length) of mList) -- This overly-long line calls the menu_recurse function with -- two arguments: r,and a reference to the top-level menu tell application "System Events" to my menu_click_recurse(r,((process appName)'s ? (menu bar 1)'s (menu bar item topMenu)'s (menu topMenu))) end menu_click on menu_click_recurse(mList,parentObject) local f,r -- `f` = first item,`r` = rest of items set f to item 1 of mList if mList's length > 1 then set r to (items 2 through (mList's length) of mList) -- either actually click the menu item,or recurse again tell application "System Events" if mList's length is 1 then click parentObject's menu item f else my menu_click_recurse(r,(parentObject's (menu item f)'s (menu f))) end if end tell end menu_click_recurse menu_click({"Safari","Develop","Simulator","index.html"}) 模拟器打开后,单击运行脚本(您可能需要首先允许脚本编辑器在设置中)。 (可选)您可以将脚本保存为应用程序,以便不必将脚本编辑器打开。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |