IvanJiang123
IvanJiang123
  • 发布:2023-03-20 17:03
  • 更新:2023-03-21 18:15
  • 阅读:366

【报Bug】IOS UIActivityViewController不生效

分类:HTML5+

产品分类: HTML5+

HBuilderX版本号: 3.6.18

手机系统: iOS

手机系统版本号: iOS 16

手机厂商: 苹果

手机机型: iPhone13

打包方式: 云端

示例代码:
var UIPasteboard = plus.ios.importClass("UIPasteboard");    
            var generalPasteboard = UIPasteboard.generalPasteboard();    
            generalPasteboard.plusCallMethod({setValue: msg.title, forPasteboardType: "public.utf8-plain-text"});    
            // generalPasteboard.plusCallMethod({valueForPasteboardType:"public.utf8-plain-text"});    

            var NSURL = plus.ios.import('NSURL');    
            var NSData = plus.ios.import("NSData");    
            var UIImage = plus.ios.import("UIImage");    
            var NSArray = plus.ios.import("NSMutableArray");    
            var activityItems = NSArray.arrayWithCapacity(10);    

            msg.pictures.forEach(item => {    
                var imageUrl = NSURL.URLWithString(item)    
                var data = NSData.dataWithContentsOfURL(imageUrl);    
                var localImage = UIImage.imageWithData(data);    
                activityItems.addObject(localImage);    
            });    

            var UIActivityViewController = plus.ios.importClass("UIActivityViewController");    
            var activityVC = new UIActivityViewController();    
            var activity = plus.ios.invoke(activityVC, "initWithActivityItems:applicationActivities:", activityItems, null);    
            console.log("activity == ");    
            console.log(activity);    
            var UIApplicationClass = plus.ios.importClass("UIApplication");    
            var UIAppObj = UIApplicationClass.sharedApplication();    
            var del = plus.ios.invoke(UIAppObj, "delegate");    
            var appWindowObj = plus.ios.invoke(del, "window");    
            var appRootController = plus.ios.invoke(appWindowObj, "rootViewController");    
            console.log("appRootController == ");    
            console.log(appRootController);    
            plus.ios.invoke(appRootController, "presentViewController:animated:completion:", activity, "YES", null);

操作步骤:

执行代码

预期结果:

能弹窗系统分享

实际结果:

没弹窗也没报错

bug描述:

IOS UIActivityViewController 不生效

2023-03-20 17:03 负责人:无 分享
已邀请:
DCloud_IOS_XTY

DCloud_IOS_XTY

要回复问题请先登录注册