Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Simulator WebApp/Bookmark for URL Scheme testing

I'm testing a custom URL scheme in my app, and I'd like to add a homescreen icon that calls that url. Whenever I request my custom URL, it opens my app, and then reverts Safari's address bar to the previously shown URL.

I tried to skirt this issue by editing the properties of another URL, e.g.

  1. Open Safari
  2. Navigate to http://google.com
  3. Tap the action button, and then "Add to home"

But this fails because you can't edit the URL assigned to the homescreen app.

As a fallback, I thought about just having a bookmark to the application, so I tried to bookmark a website and then edit the URL like this:

  1. Open Safari
  2. Navigate to http://google.com
  3. Tap the action button, and then "Bookmark"

but this fails because on the iOS simulator, you can't edit the URL of a bookmark (although you can do this on the device for some reason).

update: As tkanzakic points out, you can edit user-added bookmarks, just not the predefined bookmarks

Ideally, I'd like a homescreen app, but would settle for a bookmark instead.

Also, due to firewall restrictions, I can't connect this device to my Apple account, meaning I can't sync my Safari bookmarks either.

like image 934
Andy Avatar asked Mar 05 '13 13:03

Andy


2 Answers

Ah, figured it out. You can get a webapp on the homescreen pointing to any URL by following these steps:

  1. In mobile safari, navigate to any webpage, tap the action button and make a home screen icon for this webpage.
  2. Close the simulator
  3. Open the directory /Users/<USERNAME>/Library/Application Support/iPhone Simulator/6.1/Library/WebClips
  4. The webclips folder stores all the homescreen webapps; find the one you just created and open the Info.plist file in a text editor.
  5. Edit the keys (such as URL and Title) as desired.

When you next relaunch the simulator, you homescreen webapp will point to the new URL.

Optionally, you can change the icon.png to change the webapp's icon.

like image 181
Andy Avatar answered Oct 15 '22 23:10

Andy


As a fallback, I thought about just having a bookmark to the application, so I tried to bookmark a website and then edit the URL like this:

  1. Open Safari
  2. Navigate to http://google.com
  3. Tap the action button, and then "Bookmark"

but this fails because on the iOS simulator, you can't edit the URL of a bookmark (although you can do this on the device for some reason).

That is not true, it is possible to change the URL a bookmark, check this article to see how you can do it. I have done this on the Simulator and on a Device.

like image 32
tkanzakic Avatar answered Oct 15 '22 21:10

tkanzakic