ios - Ionic cordova-facebook-plugin4 fails api graph call -
i've got application i'm building , code i've got works absolutely fine on android devices gives me graph api error on ios.
here code i'm using facebook login.
constructor(private menuctrl: menucontroller, private nav: navcontroller, private playerservice: players, private userservice: users, private packservice: packs, private modalctrl: modalcontroller, private loadingctrl: loadingcontroller) { facebook.browserinit(this.fb_app_id, "v2.8"); menuctrl.enable(false, 'navmenu'); } ionviewloaded() { } dofblogin() { var permissions = new array(); let nav = this.nav; let userservice = this.userservice; let playerservice = this.playerservice; let packservice = this.packservice; var menuctrl = this.menuctrl; //the permissions facebook app needs user permissions = ["public_profile", "email", "user_friends"]; facebook.login(permissions) .then(function (response) { let userid = response.authresponse.userid; //getting name , gender properties facebook.api("me/?fields=name,gender,email,friends", permissions) .then(function (user) { user.picture = "https://graph.facebook.com/" + userid + "/picture?type=large"; user.fbid = user.id; //now have users info, let's save in nativestorage nativestorage.setitem('user', { userid: userid, name: user.name, gender: user.gender, picture: user.picture, email: user.email, fbid: user.id }) .then(function (user) { console.log("email check", user.email); //now check if there existing account email address. userservice.accountexists(user.email).then((data) => { let founduser = data; if (founduser) { user = founduser; console.log("existing user no account created"); menuctrl.enable(true, 'navmenu'); nav.setroot(dashboard); nav.pop(); nav.push(dashboard); } else { user.wins = 0; user.draws = 0; user.losses = 0; user.authenticated = true; user.maroon_points = 0; userservice.createuser(user); var createduser = {}; //get user id of newly created user db userservice.accountexists(user.email).then((data) => { createduser = { '_id': data._id }; if (createduser) { playerservice.getstarterplayers().then((data) => { var starters = data; let = 0; while (i < _.keys(starters).length) { let playerobj = { userid: createduser['_id'], playerid: starters[i]._id, position: starters[i].position }; console.log("playerobj[" + + "]", playerobj); playerservice.giveownedplayer(playerobj); i++ } }); packservice.getstarter().then((data) => { var packschosen = data; let j = 0; while (j < _.keys(packschosen).length) { let packobj = { _id: packschosen[j]._id, owner: createduser['_id'] }; console.log("packobj[" + j + "]", packobj); packservice.givesingle(packobj); j++ } }); menuctrl.enable(true, 'navmenu'); nav.setroot(dashboard); nav.pop(); nav.push(dashboard); } else { console.error("no user found"); } }); console.log("no existing user account created!"); } }); }, function (error) { console.log(error); }) }) }, function (error) { console.log("error - fb graph call failed", error); }); }
here error thrown in safari web console when inspecting app live on ios 10 iphone 6.
[error] exception: uncaught (in promise): there error making graph call. handleerror (main.js:81941) handleerror (main.js:152942) next (main.js:55809:94) (anonymous function) (main.js:57865) __tryorunsub (main.js:1389) next (main.js:1338) _next (main.js:1291) next (main.js:1255) next (main.js:7764) emit (main.js:57851) triggererror (main.js:41831) onhandleerror (main.js:41792) runguarded (polyfills.js:3:7279) r (polyfills.js:3:3818) (polyfills.js:3:3867) invoke (polyfills.js:3:11439) (anonymous function) (polyfills.js:2:30199) [error] original stacktrace: handleerror (main.js:81946) handleerror (main.js:152942) next (main.js:55809:94) (anonymous function) (main.js:57865) __tryorunsub (main.js:1389) next (main.js:1338) _next (main.js:1291) next (main.js:1255) next (main.js:7764) emit (main.js:57851) triggererror (main.js:41831) onhandleerror (main.js:41792) runguarded (polyfills.js:3:7279) r (polyfills.js:3:3818) (polyfills.js:3:3867) invoke (polyfills.js:3:11439) (anonymous function) (polyfills.js:2:30199) [error] v@file:///var/containers/bundle/application/704e4f8e-c28d-49c9-9393-0cda54106caf/pitchlife.app/www/build/polyfills.js:3:4869 s@file:///var/containers/bundle/application/704e4f8e-c28d-49c9-9393-0cda54106caf/pitchlife.app/www/build/polyfills.js:3:4298 s@file:///var/containers/bundle/application/704e4f8e-c28d-49c9-9393-0cda54106caf/pitchlife.app/www/build/polyfills.js:3:4113 file:///var/containers/bundle/application/704e4f8e-c28d-49c9-9393-0cda54106caf/pitchlife.app/www/build/polyfills.js:3:4653 invoketask@file:///var/containers/bundle/application/704e4f8e-c28d-49c9-9393-0cda54106caf/pitchlife.app/www/build/polyfills.js:3:10289 oninvoketask@file:///var/containers/bundle/application/704e4f8e-c28d-49c9-9393-0cda54106caf/pitchlife.app/www/build/main.js:41762:47 invoketask@file:///var/containers/bundle/application/704e4f8e-c28d-49c9-9393-0cda54106caf/pitchlife.app/www/build/polyfills.js:3:10232 runtask@file:///var/containers/bundle/application/704e4f8e-c28d-49c9-9393-0cda54106caf/pitchlife.app/www/build/polyfills.js:3:7647 i@file:///var/containers/bundle/application/704e4f8e-c28d-49c9-9393-0cda54106caf/pitchlife.app/www/build/polyfills.js:3:3714 invoke@file:///var/containers/bundle/application/704e4f8e-c28d-49c9-9393-0cda54106caf/pitchlife.app/www/build/polyfills.js:3:11438 file:///var/containers/bundle/application/704e4f8e-c28d-49c9-9393-0cda54106caf/pitchlife.app/www/build/polyfills.js:2:30198 handleerror (main.js:81947) handleerror (main.js:152942) next (main.js:55809:94) (anonymous function) (main.js:57865) __tryorunsub (main.js:1389) next (main.js:1338) _next (main.js:1291) next (main.js:1255) next (main.js:7764) emit (main.js:57851) triggererror (main.js:41831) onhandleerror (main.js:41792) runguarded (polyfills.js:3:7279) r (polyfills.js:3:3818) (polyfills.js:3:3867) invoke (polyfills.js:3:11439) (anonymous function) (polyfills.js:2:30199)
the issue other user compiling code in xcode had out of date versions of of global plugins using including cordova. updating these, removing , adding ios platform , adding cordova-facebook-plugin4 github master , doing rebuild seemed fix issue.
Comments
Post a Comment