简体   繁体   中英

Error when Facebook Open Graph Action shared from iOS (unsafe link)

I tried to share a Facebook Open Graph Action via official iOS SDK (last version) but for a few days now, this action returns an error and it has now stopped working. The app passed the Facebook approval, including actions and related objects and it all seems correct.

Object creation and share action

// ############## OpenGraph - Arrive At a Marina

// Photo
var photoURL = ""
if let image = firstMarina.images.first {
    photoURL = image.width1440
} else {
    photoURL = "https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png"
}
let photo = FBSDKSharePhoto(imageURL: NSURL(string: photoURL)!, userGenerated: false)

// Properties
let properties = [
    "fb:app_id": "xxxxxxxxxxxxxxxxxxxxx",
    "og:locale": NSLocale.preferredLanguages()[0].stringByReplacingOccurrencesOfString("-", withString: "_"),
    "og:type": "smartsea:marina",
    "og:title": firstMarina.name!.text,
    "og:description": firstMarina.desc!.text,
    "og:image": [photo],
    "place:location:latitude": firstMarina.location!.lat,
    "place:location:longitude": firstMarina.location!.lng
]

// Object
let object = FBSDKShareOpenGraphObject(properties: properties as [NSObject : AnyObject])

// Action
let action = FBSDKShareOpenGraphAction(type: "smartsea:arrive_at", object: object, key: "marina")

// Content
let content = FBSDKShareOpenGraphContent()
content.action = action
content.previewPropertyName = "marina"

// Share
FBSDKShareDialog.showFromViewController(self, withContent: content, delegate: self)

and the error returned

Error Domain=com.facebook.Facebook.platform Code=102 "(null)" UserInfo={error_reason=The content you're trying to share includes a link that our security systems detected to be unsafe:

https://m.facebook.com/appcenter/smartsea?fbs=9909&fb_object_id=1684374595135519

Please remove this link to continue., error_description=An error occurred during publishing., app_id=xxxxxxxxxxxxxxxxxxxxx, error_code=102}

The strange thing is that the error URL is a Facebook domain and I haven't share it this URL directly. It seems to be generated with every share action.

Any idea? Thanks!

Unfortunately I can't post a simple comment, so I have to post it as an 'answer'. I have found this article. It's about blocked URLs, but unfortunately not about blocked 'Facebook' URLs. I hope it can help.

http://www.technerves.com/2015/07/unblock-your-website-url-from-facebook.html

It connection might be getting blocked due to App transport security . App transport security is a new thing introduced in iOS9. It blocks connections to servers that don't meet certain security requirements, such as minimum TLS version etc

Please try again after turning ATS OFF from info.plist. See this link which shows how to turn ATS OFF.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM