我想在我的 Ionic 2 应用程序中“共享用户统计信息”。首先,我做了一个截图,然后我想用社交分享插件分享它..
这是我的代码:
public shareStats(): void {
// Take a screenshot and get temporary file URI
Screenshot.URI(100)
.then((img) => {
this.platform.ready().then(() => {
let message: string = 'Message';
let subject: string = 'Stats';
let file = img;
let link = 'https://www.example.com';
SocialSharing.share(message, subject, file, link);
});
}, (err) => {
let prompt = this.alertCtrl.create({
title: 'Fallo',
subTitle: err,
buttons: ['Aceptar']
});
prompt.present();
console.log(err);
});
}
好吧,屏幕截图插件似乎工作正常,但我不知道在我添加社交共享代码后会发生什么。因为我的设备通常不会打开共享选项窗口。
简而言之,我需要截屏并在社交网络上分享。但我不知道我做错了什么,因为我无法通过作为科尔多瓦插件并仅在移动设备上运行来调试它。
我作为参数发送的内容让我有点杂音:let file = img;
因为我不知道它包含什么或这个 img 返回我的数据类型Screenshot.URI
,因为我无法使用移动设备对其进行调试。
非常感谢!
伊万。