美文网首页
如何实现Safari弹出应用提示框

如何实现Safari弹出应用提示框

作者: ROBIN2015 | 来源:发表于2017-06-15 10:58 被阅读466次

Promoting Apps with Smart App Banners

Safari has a new Smart App Banner feature in iOS 6 and later that provides a standardized method of promoting apps on the App Store from a website, as shown inFigure 8-1.

Figure 8-1A Smart App Banner of the Apple Store app

Note:Smart App Banners only show on iOS, not OS X.

Smart App Banners vastly improve users’ browsing experience compared to other promotional methods. As banners are implemented in iOS 6, they will provide a consistent look and feel across the web that users will come to recognize. Users will trust that tapping the banner will take them to the App Store and not a third-party advertisement. They will appreciate that banners are presented unobtrusively at the top of a webpage, instead of as a full-screen ad interrupting the web content. And with a large and prominent close button, a banner is easy for users to dismiss. When the user returns to the webpage, the banner won’t reappear.

If the app is already installed on a user's device, the banner intelligently changes its action, and tapping the banner will simply open the app. If the user doesn’t have your app on his device, tapping on the banner will take him to the app’s entry in the App Store. When he returns to your website, a progress bar appears in the banner, indicating how much longer the download will take to complete. When the app finishes downloading, the View button changes to an Open button, and tapping the banner will open the app while preserving the user’s context from your website.

Smart App Banners automatically determine whether the app is supported on the user’s device. If the device loading the banner does not support your app, or if your app is not available in the user's location, the banner will not display.

Implementing a Smart App Banner on Your Website

To add a Smart App Banner to your website, include the followingmetatag in the head of each page where you’d like the banner to appear:

You can include three comma-separated parameters in thecontentattribute:

app-id: (Required.) Your app's unique identifier. To find your app ID from theiTunes Link Maker, type the name of your app in the Search field, and select the appropriate country and media type. In the results, find your app and select iPhone App Link in the column on the right. Your app ID is the nine-digit number in betweenidand?mt.

affiliate-data: (Optional.) Your iTunes affiliate string, if you are an iTunes affiliate. If you are not, find out more about becoming an iTunes affiliate athttp://www.apple.com/itunes/affiliates/.

app-argument: (Optional.) A URL that provides context to your native app. If you include this, and the user has your app installed, she can jump from your website to the corresponding position in your iOS app. Typically, it is beneficial to retain navigational context because:

If the user is deep within the navigational hierarchy of your website, you can pass the document’s entire URL, and then parse it in your app to reroute her to the correct location in your app.

If the user performs a search on your website, you can pass the query string so that she can seamlessly continue the search in your app without having to retype her query.

If the user is in the midst of creating content, you can pass the session ID to download the web session state in your app so she can nondestructively resume her work.

You can generate theapp-argumentof each page dynamically with a server-side script. You can format it however you'd like, as long as it is a valid URL.

Note:You cannot display Smart App Banners inside of a frame. Banners won’t appear in the iOS Simulator.

Providing Navigational Context to Your App

In your app, implement theapplication:openURL:sourceApplication:annotation:method in your app delegate, which fires when your app is launched from a URL. Then provide logic that can interpret the URL that you pass. The value you set to theapp-argumentparameter is available as theNSURLurlobject.

The example inListing 8-1illustrates a website that passes data to a native iOS app. To accomplish this, detect if the URL contains the string/profile. If it does, then open the profile view controller and pass the profile ID number that is in the query string.

Listing 8-1Routing the user to the correct view controller

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation

{

// in this example, the URL from which the user came is http://example.com/profile/?12345

// determine if the user was viewing a profile

if ([[url path] isEqualToString:@"/profile"]) {

// switch to profile view controller

[self.tabBarController setSelectedViewController:profileViewController];

// pull the profile id number found in the query string

NSString *profileID = [url query];

// pass profileID to profile view controller

[profileViewController loadProfile:profileID];

}

return YES;

}

参见:https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html

相关文章

  • 如何实现Safari弹出应用提示框

    Promoting Apps with Smart App Banners Safari has a new Sm...

  • XXAlertView使用

    XXAlertView对UIAlertController封装,能够方便的实现警告框。 使用方法 弹出提示框 弹出...

  • swal的几种用法

    1,弹出提示框,点击确认,进行下一步操作 2,仅弹出提示框 3,仅弹出提示框,简单写法

  • iOS 拨打电话的三种方式

    1:直接拨打, 不会弹出提示框 2: 会弹出提示框 3:会弹出提示框(注意:这里是telprompt, 推荐用这种...

  • 提示框

    target:点击按钮---->屏幕中间弹出提示框 target:点击按钮---->屏幕底部弹出提示框

  • iOS 跳转到系统的设置界面

    一、如何代码实现跳转safari,phone或message? 调用 电话phonea.拨打完电话回不到原来的应用...

  • 今日成果

    本来想如果不填字的话,实用AlertDialog弹出一个提示框,然后填字的话就弹出这个搜索框,但是没有实现很遗憾。...

  • 普通的提示框

    弹出提示框,点击确定取消提示框 (void)showError:(NSString *)errorMsg {// ...

  • 手机 window.open

    如果safari什么也没弹出有可能设置 safari阻止弹出式窗口 I using trying to use w...

  • 前端、js、html、i.js、提示框、对话框、警告框

    前端页面如何 弹出提示框 呢? 调用 io() 这个功能即可。 直接上代码: ...

网友评论

      本文标题:如何实现Safari弹出应用提示框

      本文链接:https://www.haomeiwen.com/subject/lypyqxtx.html