• 程序跳转到itunes商店


    找到应用程序,点击应用程序下面的小三角图标,再选择”复制链接“,就可以获取此应用的链接了。

    比如:

    itunes.apple.com/cn/app/bai-du-wen-kuhd/id483064532?mt=8

    然后将 https:// 替换为 itms:// 或者 itms-apps://:

    然后在程序中写如下代码:
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms://itunes.apple.com/cn/app/bai-du-wen-kuhd/id483064532?mt=8"]];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itunes.apple.com/cn/app/bai-du-wen-kuhd/id483064532?mt=8"]]	
    注意:只能在真机上调试出效果,模拟器上无效果。
    "Error Domain=WebKitErrorDomain Code=101 The URL can't be shown."
    http://stackoverflow.com/questions/4299403/how-to-handle-app-urls-in-a-uiwebview

    http://stackoverflow.com/questions/4299403/how-to-handle-app-urls-in-a-uiwebview
    - (void)webView:(UIWebView *)wv didFailLoadWithError:(NSError *)error {
       
    // Give iOS a chance to open it.
        NSURL
    *url = [NSURL URLWithString:[error.userInfo objectForKey:@"NSErrorFailingURLStringKey"]];
       
    if ([error.domain isEqual:@"WebKitErrorDomain"]
           
    && error.code == 101
           
    && [[UIApplication sharedApplication]canOpenURL:url])
       
    {
           
    [[UIApplication sharedApplication]openURL:url];
           
    return;
       
    }

       
    // Normal error handling…
    }

    - (BOOL)webView:(UIWebView *)wv shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {

        // Determine if we want the system to handle it.
        NSURL *url = request.URL;
        if (![url.scheme isEqual:@"http"] && ![url.scheme isEqual:@"https"]) {
            if ([[UIApplication sharedApplication]canOpenURL:url]) {
                [[UIApplication sharedApplication]openURL:url];
                return NO;
            }
        }
        return YES;
    }

    - (void)webView:(UIWebView *)wv didFailLoadWithError:(NSError *)error {
        // Ignore NSURLErrorDomain error -999.
        if (error.code == NSURLErrorCancelled) return;

        // Ignore "Fame Load Interrupted" errors. Seen after app store links.
        if (error.code == 102 && [error.domain isEqual:@"WebKitErrorDomain"]) return;

        // Normal error handling…
    }

    iphone开发笔记和技巧总结(原址持续更新)转载


    http://www.cnblogs.com/zhwl/archive/2012/03/09/2387530.html
  • 相关阅读:
    java代码split分割数字类
    P1330 封锁阳光大学
    1022 舞会2
    1626 爱在心中
    P2024 食物链(two)
    P1196 银河英雄传说
    P1892 团伙
    P1546 最短网络(最小生成树)
    烦人的幻灯片(拓扑)
    例4.15 奖金(拓扑排序)
  • 原文地址:https://www.cnblogs.com/zsw-1993/p/4879831.html
Copyright © 2020-2023  润新知