问题
I am working on a project in appMobi, and this project has recently reached it portion that is related to facebook. However there just seems to be soo many moving parts that its virtually impossible to tell whats going on with what where and how.. more so, when everything works in the emulator but not on a device, where there is no console, no error log, nothing to work with to try and figure out the issue.
The image below is the only error I get on my device. When attempting to communicate with facebook, through appMobi specific methods. I have litteraly copied and pasted there code trying to make this work cause I know once I can see this working and how its going to work I can then start building logic around something I actually want to do. That being a mute point at the moment. Anyway, when I run this same exact code in the emulator it works exactly as expected. But running it in Test Anywhere on the device itself seems to be where this conflict is coming in.
Soo I am wondering, has anyone had this issue before out there on stack? If so what did you do to fix it? Whats the work around? Whats the means of how you debugged it and came to the conclusion as I am sure I am going to run into similar problems down the road and debugging on the device is also a bonus.
my javascript currently:
document.addEventListener("appMobi.facebook.login",function(e){
if (e.success == true)
{ console.log("Facebook Log in Successful"); }
else
{ console.log("Unsuccessful Login"); }
},false);
function fbLoginCheckz()
{
try{
AppMobi.facebook.login('user_birthday,user_about_me,user_status,offline_access,publish_stream,publish_actions,email,read_friendlists,publish_checkins,create_event');
}catch(e){
alert("Error Caught [FB 1]: "+e.message);
}
}
document.addEventListener("appMobi.facebook.logout",function(e){
if (e.success == true)
{ console.log("Logged out of Facebook"); }
else
{ console.log("Unsuccessful Logout"); }
},false);
var facebookUserID = "me"; //me = the user currently logged into Facebook
document.addEventListener("appMobi.facebook.request.response",function(e) {
console.log("Facebook User Friends Data Returned");
if (e.success == true) {
var data = e.data.data;
var outHTML = "";
for (var r=0; r< data.length; r++) {
outHTML += "<img src='http://graph.facebook.com/" + data[r]["id"]
+ "/picture' info='" + data[r]["name"] + "' />";
}
$("#blah").empty().html(outHTML);
document.removeEventListener("appMobi.facebook.request.response");
}
},false);
my html:
<br><br>
<div id="blah"></div>
<a href="#" onclick="window.location.reload();">RELOAD</a><br>
<a href="#" onclick="fbLoginCheckz();">LOGIN</a><br>
<a href="#" onclick="AppMobi.facebook.logout();">LOGOUT</a><br>
<a href="#" onclick="AppMobi.facebook.requestWithGraphAPI(facebookUserID + '/friends','GET',null);">FRIENDS</a>
回答1:
There was a problem with the build system and the test containers. If you build an adHoc version of your software it should work. However, all my "test anywhere" helper applications also still have the bug for the time being.
There should be an update to the test containers shortly that should fix the problem. I'll try to post back here once they have been updated.
来源:https://stackoverflow.com/questions/11926752/facebook-appmobi-debugging-when-theres-no-distinct-error