Репост в Instagram без сохранения файла локально - PullRequest
0 голосов
/ 20 февраля 2020

Я пытаюсь добавить в свое приложение функцию репоста фотографий и видео из Instagram. Я пытался использовать этот код:

import Photos
...

func postImageToInstagram(image: UIImage) {
    UIImageWriteToSavedPhotosAlbum(image, self, #selector(image(_:didFinishSavingWithError:contextInfo:)), nil)
}
@objc func image(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) {
        if error != nil {
            print(error)
        }

        let fetchOptions = PHFetchOptions()
        fetchOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]

        let fetchResult = PHAsset.fetchAssets(with: .image, options: fetchOptions)

        if let lastAsset = fetchResult.firstObject as? PHAsset {

            let url = URL(string: "instagram://library?LocalIdentifier=\(lastAsset.localIdentifier)")!

            if UIApplication.shared.canOpenURL(url) {
                UIApplication.shared.open(url)
            } else {
                let alertController = UIAlertController(title: "Error", message: "Instagram is not installed", preferredStyle: .alert)
                alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
                self.present(alertController, animated: true, completion: nil)
            }

        }
}

, но Apple блокирует приложения, которые локально сохраняют фотографии и видео из Instagram:

Your app allows users to save or download music, video, or other media content without authorization from the relevant third-party sources.

The app saves content locally as part of the repost process.

The next submission of this app may require a longer review time, and this app will not be eligible for an expedited review until this issue is resolved.

Как я могу перепечатывать фотографии и видео из Instagram, не сохраняя их на пользовательское устройство? Является ли это возможным? И для меня также важно размещать не только фотографии, но и видео из Instagram.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...