How could I create a shortcut on desktop in iOS through an app

后端 未结 3 1116
深忆病人
深忆病人 2020-12-08 08:41

What do I mean is that I want to use the app to create a shortcut with icon on the desktop which will allow user to speed access some functions of this app.

How coul

3条回答
  •  萌比男神i
    2020-12-08 09:19

    You can not add icons to the 'desktop' (Springboard) other than your application's. What this app is doing is displaying a replica of the iPhone 'desktop' within their app.

    UPDATE: The link now points to an app which does this and it seems it is somewhat possible although rather hack in my opinion.

    This is how I believe the application works (it is similar to answer below but in more detail).

    • The application creates the webclip image and sends it and the phone number to a web service.
    • The web service then creates a page with the webclip information attached. The phone number/email is converted to a url which will trigger the corresponding app (Mail/Messages/Phone). i.e "+834 895 734" -> tel:834895734 or sms:834895734
    • The app then opens that page in MobileSafari and that page
      presumably has instructions on how to "Add to Homescreen".
    • The user will then have to navigate to and tap the "Add to Homescreen" button. This will add the webclip to the Springboard as an icon.
    • When tapped the webclip activates the url and the Mail/Messages/Phone is launched with the number/email

    You could implement something similar (although I wouldnt suggest it). These are the steps to follow:

    • Register your own url scheme
    • Host a page somewhere which contains a webclip for each function/url you want a shortcut for. If the urls are not static or you want dynamic icons, you will need a web service.
    • Handle the url in your application in this AppDelegate method

    - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url

    Note: If your application is deleted, the webclips will no longer work and will confuse the user. Apple may also reject your app.

提交回复
热议问题