我怎样才能让我的 Imessage 贴纸可以在 whatsapp 中使用
How can I make my Imessage stickers being available to be used in whatsapp
我想知道是否可以在 whatsapp 中分享 Imessage 贴纸。如果可能的话,我该如何为应用程序编写代码?
为此,您需要使用贴纸构建一个单独的键盘扩展,以便在 WhatsApp 中将它们作为图像或 GIF 发送。
从 GitHub 下载示例项目和所需文件:
https://github.com/WhatsApp/stickers/tree/master/iOS
然后使用以下代码创建贴纸包:
let stickerPack = StickerPack(identifier: "identifier",
name: "sticker pack name",
publisher: "sticker pack publisher",
trayImageFileName: "tray image file name",
publisherWebsite: "publisher website URL",
privacyPolicyWebsite: "privacy policy website URL",
licenseAgreementWebsite: "license agreement website URL")
将贴纸添加到贴纸包:
stickerPack.addSticker(contentsOfFile: "file name of sticker image",
emojis: ["array of emojis"])
调用以下方法将贴纸包导入 Whatsapp:
stickerPack.sendToWhatsApp { completed in
// Called when the sticker pack has been wrapped in a form that WhatsApp
// can read and WhatsApp is about to open.
}
您必须在 Info.plist
文件中添加 LSApplicationQueriesSchemes
:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>whatsapp</string>
</array>
此外,您必须使用一些限制和预定义语法,
阅读有关创建 whatsapp 贴纸的更多信息:
我想知道是否可以在 whatsapp 中分享 Imessage 贴纸。如果可能的话,我该如何为应用程序编写代码?
为此,您需要使用贴纸构建一个单独的键盘扩展,以便在 WhatsApp 中将它们作为图像或 GIF 发送。
从 GitHub 下载示例项目和所需文件: https://github.com/WhatsApp/stickers/tree/master/iOS
然后使用以下代码创建贴纸包:
let stickerPack = StickerPack(identifier: "identifier",
name: "sticker pack name",
publisher: "sticker pack publisher",
trayImageFileName: "tray image file name",
publisherWebsite: "publisher website URL",
privacyPolicyWebsite: "privacy policy website URL",
licenseAgreementWebsite: "license agreement website URL")
将贴纸添加到贴纸包:
stickerPack.addSticker(contentsOfFile: "file name of sticker image",
emojis: ["array of emojis"])
调用以下方法将贴纸包导入 Whatsapp:
stickerPack.sendToWhatsApp { completed in
// Called when the sticker pack has been wrapped in a form that WhatsApp
// can read and WhatsApp is about to open.
}
您必须在 Info.plist
文件中添加 LSApplicationQueriesSchemes
:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>whatsapp</string>
</array>
此外,您必须使用一些限制和预定义语法, 阅读有关创建 whatsapp 贴纸的更多信息: