• whatsapp


    //文字分享

     NSString *msg = @"您好";

        NSString *url = [NSString stringWithFormat:@"whatsapp://send?text=%@", [msg stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]]];

        NSURL *whatsappURL = [NSURL URLWithString: url];

        

        if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"whatsapp://app"]]){

         

                // [[UIApplication sharedApplication] openURL: whatsappURL];

            

            [[UIApplication sharedApplication] openURL:whatsappURL options:@{} completionHandler:nil];

                

                NSLog(@"fff");

    // 图片分享

    //             UIImage     * iconImage = [UIImage imageNamed:@"icon.png"];

    //        

    //            

    //    [UIImageJPEGRepresentation(iconImage, 1.0) writeToFile:savePath atomically:YES];

    //            

    //            

    //            _documentInteractionController = [[UIDocumentInteractionController alloc]init];

    //            _documentInteractionController.UTI = @"net.whatsapp.image";

    //            

    //            

    //             _documentInteractionController.delegate = self;

    //            

    //            

    //            [_documentInteractionController presentOpenInMenuFromRect:self.view.bounds inView:self.view animated: YES];

            

          //  }

            

            

        } else {

            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"WhatsApp not installed." message:@"Your device has no WhatsApp installed." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];

            [alert show];

        } 

    需要注意的plist文件中也需要加入白名单

    LSApplicationQueriesSchemes Array类型

      whatsapp 

    一天一章
  • 相关阅读:
    Android应用四大组件和应用程序的生命周期
    DOCTYPE html PUBLIC 指定了 HTML 文档遵循的文档类型定义
    Web前端灰框技术
    用JS实现在页面关闭或刷新时触发特定的事件
    style.display的全部属性值
    Android SDK更新的问题
    页面灰框模式精彩实现
    解决sql 语句中truncate语句不支持变量的问题
    获取网页中图片链接的路径的正则表达式
    web页面自动保存本页面的内容到本地
  • 原文地址:https://www.cnblogs.com/hangman/p/6911767.html
Copyright © 2020-2023  润新知