1
DispatchQueue.main.async
{
var x : Int = 0
for item in self.arrGifs
{
let gif : GIF = item as! GIF
let gifName = URL(string: gif.gifImage)?.lastPathComponent
// let ur
let pathUrl = URL.urlInDocumentsDirectory(with: "\(gifName!)").path
print("image path is =====>", pathUrl)
//RawImages.xcassets
// if let url = Bundle.main.url(forResource:"3", withExtension: "gif")
// {
print("url is ------>>>> ",url)
do
{
let sticker = try
// MSSticker(contentsOfFileURL: url,localizedDescription: "")
MSSticker(contentsOfFileURL: URL(string:pathUrl)!,localizedDescription: "")
self.arrSticker.append(sticker)
}
catch
{
print(error.localizedDescription)
}
// }
}
self.createStickerBrowser()
}
上記の「MSSticker(contentsOfFileURL:url、localizedDescription: "")」バンドルに保存されたステッカーを取得できます。しかし、私が書類の指示の道を与えれば、ステッカーは示されません。 私は、ユーザーがオフラインで見ることができるように、私のsqlite(画像名)と文書指示の画像を保存して、apiからimgesをダウンロードしています。私は解決策を見つけません。何が間違っているのか、それを正しく行う方法を助ける必要があります。 ありがとうございます。スウィフトのドキュメントディレクトリからステッカーを表示するには
file:///private/var/containers/Bundle/Application/F8FF754B-F012-4B75-AA2E-9FA71846E6AB/Migos%20Lingo.app/PlugIns/MigosLingo.appex/3.gif === this from Bundle and I can view as Sticker
/var/mobile/Containers/Data/PluginKitPlugin/DE11FB0E-89F9-4A65-917E-B4FEB8CA5470/Documents/111111-1508763742.gif ===> Document directry and I cannot view as Stickers
はい。 /var/mobile/Containers/Data/PluginKitPlugin/DE11FB0E-89F9-4A65-917E-B4FEB8CA5470/Documents/111111-1508763742.gif ---- 111111-1508763742.gif ---私の画像名です。 –
サーバーからgifファイルをダウンロードした後、どのようにイメージを保存していますか? –