0
인스턴트 2.2와 함께 사진을 Instagram에 공유하는 기능을 사용하고 있으며 iOS9에서는 작동하지만 iOS10에서는 작동하지 않습니다. iOS9와 iOS10간에 차이가 있습니까? 다음은 iOS9에서 어떤 조언을 해 주셔서 감사합니다.Instagram openURL 및 canOpenURL 변경시 iOS10 swift 2.2 공유
class viewController: UIViewController, UIDocumentInteractionControllerDelegate {
var yourImage: UIImage?
var documentController: UIDocumentInteractionController!
func shareToInstagram() {
let instagramURL = NSURL(string: "instagram://app")
if (UIApplication.sharedApplication().canOpenURL(instagramURL!)) {
let imageData = UIImageJPEGRepresentation(yourImage!, 100)
let captionString = "caption"
let writePath = (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent("instagram.igo")
if imageData?.writeToFile(writePath, atomically: true) == false {
return
} else {
let fileURL = NSURL(fileURLWithPath: writePath)
self.documentController = UIDocumentInteractionController(URL: fileURL)
self.documentController.delegate = self
self.documentController.UTI = "com.instagram.exlusivegram"
self.documentController.annotation = NSDictionary(object: captionString, forKey: "InstagramCaption")
self.documentController.presentOpenInMenuFromRect(self.view.frame, inView: self.view, animated: true)
}
} else {
print(" Instagram isn't installed ")
}
}
어떻게 실패합니까? 오류가 있습니까? 조용히 실패합니까? –
안녕하세요 @ NicolasMiari, iOS 10 기기에서 사진을 공유하려고 할 때 응답이 없습니다. 예, 조용히 실패합니다. 그 후에도 계속 작동하는 앱입니다. –