I’ve done my research and have followed the syntax steps in other issues that I’ve found online. However, I still continue to experience the same problem.
My API call is working in Android Studio, but gives me the generic error, “There was an error making the graph call”, in iOS. In Android, it posts to the proper business page just fine. iOS is the only place giving me the error.
ios-deploy : 1.9.1
ios-sim : 6.0.0
Node : v6.11.1
npm : 3.10.10
OS : macOS High Sierra
Xcode : Xcode 9.4.1 Build version 9F2000
Below is my function for making the API call using the plugin. Any help would be appreciated. Please note that I’m making an API call to access a Business Page and not a User Account.
this.fb.api(this.requestData.facebook_id + "/?fields=access_token",["manage_pages","publish_pages"])
.then(res => {
let access_token = res.access_token;
let facebookString = this.requestData.facebook_id + "/feed/?fields=id" + "&method=post" + "&link=" + link
if(this.post.facebook_message != null && this.post.facebook_message != ""){
facebookString += "&message=" + this.post.facebook_message;
}
facebookString += "&access_token=" + access_token;
this.fb.api(facebookString,["manage_pages","publish_pages"])
.then(res => {
this.loading.dismissAll();
this.viewCtrl.dismiss('update');
let toast = this.toastCtrl.create({
message: 'Your Post Was Shared to Facebook!',
duration: 3000,
position: 'top'
});
toast.present();
})
.catch(e => {
this.loading.dismissAll();
this.viewCtrl.dismiss('update');
let toast = this.toastCtrl.create({
message: 'Error Sharing Your Post to Facebook',
duration: 3000,
position: 'top'
});
toast.present();
});
})
.catch(e => {
console.log(e);
});
I have success in retrieving the token. However, when it goes to post to Facebook, that’s where the error occurs. I have my local code CONSOLE.LOGing some things out to xCode so you can see what I mean.
Here’s my log from xCODE…
RETURNED PAGE TOKEN
2018-06-30 15:04:47.748228-0500 Rockford Buzz[11257:736620] {“id”:“54685000003347”,“access_token”:“EAAMVzZC9aJgcBAEi9ugkTXbUWdECcfya78YG0SyyVVZAODFvbZBIkDK4LWThggE67oOcI9gELZA1FrzfBTyxUPfB7ZAxueZfdsassdffdZBGRZBzuYECAretrV3aFO2aGHZByEkGJ1qCjCBZBblRQMk2Vfm5SlhYynkFPSTC6y2E5XkywZDZD”}
2018-06-30 15:04:47.749212-0500 Rockford Buzz[11257:736620] FACEBOOK STRING
2018-06-30 15:04:47.749570-0500 Rockford Buzz[11257:736620] 546850000003347/feed/?fields=id&method=post&link=https://rockfordbuzz.com/story/Post-11014&message=Check out our exciting news on Rockford Buzz!&access_token=EAAMVzZC9aJgcBAEi9ugkTXbUWdECcfya78YG0SyyVVZAODFvbZBIkDK4LWThggE67oOcI9gELZA1FrzfBTyxUPfB7ZAxueZAd9ZCNMvsdfdffdssaYECAretrV3aFO2aGHZByEkGJ1qCjCBZBblRQMk2Vfm5SlhYynkFPSTC6y2E5XkywZDZD
2018-06-30 15:04:47.749880-0500 Rockford Buzz[11257:736620] Graph Path = 546800000023347/feed/?fields=id&method=post&link=https://rockfordbuzz.com/story/Post-11014&message=Check out our exciting news on Rockford Buzz!&access_token=EAAMVzZC9aJgcBAEasdfdfsdaCcfya78YG0SyyVVZAODFvbZBIkDK4LWThggE67oOcI9gELZA1FrzfBTyxUPfB7ZAxueZAd9ZCNMvNpZBGRZBzuYECAretrV3aFO2aGHZByEkGJ1qCjCBZBblRQMk2Vfm5SlhYynkFPSTC6y2E5XkywZDZD
2018-06-30 15:04:47.760288-0500 Rockford Buzz[11257:736620] THREAD WARNING: [‘FacebookConnectPlugin’] took ‘10.426025’ ms. Plugin should use a background thread.
2018-06-30 15:04:47.760490-0500 Rockford Buzz[11257:747778] Task <0325A7CE-6449-4EA6-88BD-7BF600367236>.<1> finished with error - code: -1002
2018-06-30 15:04:47.779632-0500 Rockford Buzz[11257:736620] Finished GraphAPI request
2018-06-30 15:04:47.786210-0500 Rockford Buzz[11257:736620] ERROR REPORT
2018-06-30 15:04:47.787678-0500 Rockford Buzz[11257:736620] There was an error making the graph call.
The first API call passes the Facebook Page ID to the call in order to retrieve the access_token for the PAGE (as opposed to the token for the user)
The second API call is what does the posting… if you look at my “facebookString” variable, you’ll see that I pass the “method=Post” into the string, telling the graph API that this is a POST not a GET call. The reason for the first API call is to grab the PAGE token (ensuring it’s fresh) in order to pass that token along in the second call which does the actual posting.
Yes, that part of the message is from my code… the only thing I get from xCode log is…
Finished GraphAPI request
2018-07-01 15:17:14.584855-0500 Rockford Buzz[16606:1219266] TIC Read Status [6:0x0]: 1:57
2018-07-01 15:17:14.585314-0500 Rockford Buzz[16606:1219266] TIC Read Status [6:0x0]: 1:57
2018-07-01 15:17:14.590796-0500 Rockford Buzz[16606:1204574] ERROR REPORT
2018-07-01 15:17:14.591680-0500 Rockford Buzz[16606:1204574] There was an error making the graph call.
[DEBUG] Did open connection on socket 25
[DEBUG] Did connect
[DEBUG] Did start background task
[DEBUG] Connection received 689 bytes on socket 25
[DEBUG] Connection on socket 25 preflighting request “GET /Users/jacobbradt/Library/Developer/CoreSimulator/Devices/892F80F3-2A8E-4D89-90A7-368874D4BC59/data/Containers/Bundle/Application/CB23AD02-2FBC-416E-854E-D6BAC9F85F71/Rockford Buzz.app/www/build/26.js” with 689 bytes body
[DEBUG] Connection on socket 25 processing request “GET /Users/jacobbradt/Library/Developer/CoreSimulator/Devices/892F80F3-2A8E-4D89-90A7-368874D4BC59/data/Containers/Bundle/Application/CB23AD02-2FBC-416E-854E-D6BAC9F85F71/Rockford Buzz.app/www/build/26.js” with 689 bytes body
[DEBUG] Connection sent 310 bytes on socket 25
[DEBUG] Connection sent 32768 bytes on socket 25
[DEBUG] Connection sent 22998 bytes on socket 25
[DEBUG] Did close connection on socket 25
[VERBOSE] [127.0.0.1:8080] 127.0.0.1:64645 200 “GET /Users/jacobbradt/Library/Developer/CoreSimulator/Devices/892F80F3-2A8E-4D89-90A7-368874D4BC59/data/Containers/Bundle/Application/CB23AD02-2FBC-416E-854E-D6BAC9F85F71/Rockford Buzz.app/www/build/26.js” (689 | 56076)
[DEBUG] Did disconnect
[DEBUG] Did end background task
2018-07-01 15:17:55.053795-0500 Rockford Buzz[16606:1204574] CDVWKWebViewEngine: handleStopScroll
2018-07-01 15:17:55.976786-0500 Rockford Buzz[16606:1204574] CDVWKWebViewEngine: handleStopScroll
Also, I removed the message. No spaces in the Graph Call, but still receive the error. Here’s my Graph Call.
Maybe try to upgrade to v2.2.0 or downgrade to v1.74 the facebook4 plugin? If one or the other solution might work it would means that there is a bug inside the Facebook iOS SDK
also that’s the first google search solution to your error msg, did you check that you have both NSAppTransportSecurity and NSAllowsArbitraryLoads in your plist?
The error I’m receiving is 1002. I Google’d the crap out of that thing and didn’t have any luck. Just to be sure, I did check my plist and found the key already there. Here’s the section regarding Transport Security for your review. I’ll give 1.7.4 a try and see what happens
Thx for the feedback. I’ve to say I’m a bit out of idea, I’ll think about it but the iOS code of the plugin itself didn’t change in ages except the Facebook iOS SDK which according your tests also doesn’t work (old or new, same same). If there is a bug that would mean that you landed on a bug which is there since maybe a long long time and which no one ever faced?
Have you try to reproduce the problem with a totally separate dummy and simple app?
Sometimes with a brand new simple app/platform the problem doesn’t occurs and then it’s possible to compare what’s different…just an idea