So I recall that Firebug has a lite version that works on Safari and IE and I figure that will do the trick. Additionally, there's a bookmark method of loading Firebug only on the pages where and when you want it to load. Sweet!
Did you know that the top level bookmarks in Safari on the iPhone Simulator are read only? As in, you can't change them? As in, you can't add new ones to the top level? I sure didn't.
Now I know you're saying to yourself "Jeff, you big doofus. You can create new folders in the bookmarks listing and then add your bookmark there." Well, you're right...sort of. You can add bookmarks, but it's not always successful in letting you change the URL for the bookmark. For example, in the iPhone4 simulator with the 4.1 SDK, you can add a bookmark, but you can't paste in a different URL to overwrite the one that's added automatically when you create the bookmark. On the other hand, in the iPad simulator with the 3.2 SDK, you can overwrite the URL. It's inconsistent enough to make me take a pass on that technique.
So now my two options were to either add the Firebug lite script tag to each page that I was having problems with, or figuring out how to edit the top level bookmark list to add the Firebug bookmark I needed.
After a bit of futzing around (that's the technical term), I figured it out. The bookmarks themselves live in a property list file called StaticBookmarks-<language_code>.plist, and there one file for each language code. Since I'm in the US, the file that I needed was called StaticBookmarks-en_US.plist. The (not so) tricky question is where that file lives, and the answer is "it depends on which iPhone Simulator SDK you're working in". On my iPhoneSimulator SDK setup, I have 3 versions of the SDK -- 3.2, 4.0 and 4.1 -- so I have 3 versions of the StaticBookmarks-en_US.plist file, one in each SDK setup. The key is to know which SDK the iPhone Simulator is using. Which is easy enough because the iPhone Simulator shows you (Hardware -> Version). For since the iPad version of the Simulator works in the 3.2 version (and only the 3.2 version), my StaticBookmarks-en_US.plist file is in the 3.2 version of the iPhone Simulator SDK.
The plist file itself it embedded in the MobileSafari.app folder under the specific iPhoneSimulator SDK. I found mine here: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/Applications/MobileSafari.app/. In that folder are a bunch of files including the MobileSafari executable and all the StaticBookmarks files. The issue with editing the plist file is that your normal user permissions won't have write-access to that file, however it's easy enough to open up the plist file as sudo and edit it. Here's how:
- Open up a Terminal Window
- cd /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/Applications/MobileSafari.app
sudo "/Developer/Applications/Utilities/Property List Editor.app/Contents/MacOS/Property List Editor" StaticBookmarks-en_US.plist
- Right-Click on the "Root" line.
- Select "Add Row" from the Context Menu. That will become "Item 0" in the list.
- Change the type of "Item 0" from "String" to "Dictionary"
- Click on the triangle next to "Item 0" to open it up.
- Right-Click on "Item 0" and select "Add Row"
- For the new Row (under "Item 0") set the Key = "Title" and the value = "Firebug Lite"
- Right-Click on the new "Title" row (that you just added) and select "Add Row"
That's it! Save the file (which you can do because you're running the Property List Editor as the root user) and then restart the iPhone Simulator. Open the Safari Browser in the Simulator and voila! There's your bookmark. Just remember to select the SDK in the iPhone Simulator that matches the SDK of the StaticBookmarks file that you changed.