集成Facebook图形APi进行分析时出现问题

时间:2018-08-06 05:24:58

标签: ios swift fbsdk

我正在将Facebook post分析集成到我的应用程序中,并且为此使用了图api,但没有得到响应,却收到如下错误

错误

Error: Optional(Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSUnderlyingError=0x60400065a910 {Error Domain=kCFErrorDomainCFNetwork Code=-1002 "(null)"}, NSErrorFailingURLStringKey=(null)?access_token=EAAC5SyZBtEogBADENnWv1FJEcJGWa2gOZBiruXazI3aK2ldBXZBPBppntfoRqtexEUwQOKAjLC2Fvr6vortsZAIoyHCVeVPG2dzlfPHssNZAZBOihh1cBfk8cQ2RNUW506QhUkOJbpTKJd6KC1MZAMgJZBG41uyulpbZA47gYCD95Qnr7rSK6H64V5eHGaa8vYCubHhelt9EOUD7jkZCLeiwvdzv2hml1QmlkGiNSedlXEERYVR7nhlLYd&format=json&include_headers=false&sdk=ios, NSErrorFailingURLKey=(null)?access_token=EAAC5SyZBtEogBADENnWv1FJEcJGWa2gOZBiruXazI3aK2ldBXZBPBppntfoRqtexEUwQOKAjLC2Fvr6vortsZAIoyHCVeVPG2dzlfPHssNZAZBOihh1cBfk8cQ2RNUW506QhUkOJbpTKJd6KC1MZAMgJZBG41uyulpbZA47gYCD95Qnr7rSK6H64V5eHGaa8vYCubHhelt9EOUD7jkZCLeiwvdzv2hml1QmlkGiNSedlXEERYVR7nhlLYd&format=json&include_headers=false&sdk=ios, NSLocalizedDescription=unsupported URL})

现在我将穿上我的代码

代码

  func PostList(){
        var Requset : FBSDKGraphRequest

        print("\(FBSDKAccessToken.current())")

        let acessToken = String(format:"%@", FBSDKAccessToken.current().tokenString) as String

        print("\(acessToken)")

        let parameters1 = ["access_token":FBSDKAccessToken.current()!]


        Requset  = FBSDKGraphRequest(graphPath:"me/?fields=feed{message,full_picture,id,application,likes{name,pic_crop},comments{message,from,created_time},created_time}", parameters: parameters1 , httpMethod:"GET")!

        Requset.start(completionHandler: { (connection, result, error) -> Void in

            if ((error) != nil)
            {
                print("Error: \(error)")
            }
            else
            {
                print("fetched user: \(result)")

            }
        })
    }

如果我在图api资源管理器中运行此图路径,则其工作正常,但在此应用中我遇到此错误

0 个答案:

没有答案