zoukankan      html  css  js  c++  java
  • 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 

    一天一章
  • 相关阅读:
    mysql全文索引
    oracle窗口函数的实战
    数据库的三大范式
    Oracle12cR1 Data Guard 实施文档
    Oracle 11gR2 RAC 删除节点
    Jboss部署文档
    Hexo搭建静态博客踩坑日记(一)
    一行代码引入博客园樱花飘落特效
    Hexo搭建静态博客踩坑日记(二)
    学习axios必知必会(2)~axios基本使用、使用axios前必知细节、axios和实例对象区别、拦截器、取消请求
  • 原文地址:https://www.cnblogs.com/hangman/p/6911767.html
Copyright © 2011-2022 走看看