I'm using version 5.2.0 of appcelerator's facebook module on the 5.4.0GA sdk. I'm able to post a link to facebook with the following code:
var data = {link: "http://www.stackfish.com" };
fb.requestWithGraphPath('me/feed', data,"POST",showRequestResult);
But when I try to post a photo using the example code I've found I get an array mutation error. Here's the code that causes the error on IOS (it works fine on droid):
if ( fb.getLoggedIn() == true )
{
// Ti.API.info('1.5.5 PostTo FacebookLogged In Perissions = ' + fb.permissions);
Titanium.Media.openPhotoGallery({
success:function(event)
{
var data = {picture: event.media, caption: 'test'};
Titanium.Facebook.requestWithGraphPath('me/photos', data, "POST", showRequestResult);
},
cancel:function()
{
},
error:function(error)
{
},
allowEditing:true
});
Here's the error:
[ERROR] : Script Error {
[ERROR] : column = 2506;
[ERROR] : line = 1;
[ERROR] : message = "*** Collection <__NSDictionaryM: 0x14ee27430> was mutated while being enumerated.";
[ERROR] : sourceURL = "file:///var/containers/Bundle/Application/110C8EFE-A325-4D3C-A15C-AC0FFA89C418/Stackfish.app/alloy/controllers/PostReview.js";
[ERROR] : stack = "[native code]\nsuccess#file:///var/containers/Bundle/Application/110C8EFE-A325-4D3C-A15C-AC0FFA89C418/Stackfish.app/alloy/controllers/PostReview.js:1:2506";
[ERROR] : }
Does anyone have any ideas on what I'm doing wrong? Thanks
Looks valid to me. I created a JIRA-ticket for you here: MOD-2286
We need to remove the fast-iteration to a classic-iteration to avoid mutation issues. Please follow the ticket and give feedback there, thanks!
Related
I have followed this GitHub URL to integrate Facebook sharing in my application.
https://github.com/facebook/react-native-fbsdk
Here is my code:
constructor(props){
super(props);
this.state={
shareLinkContent : {
contentType: 'link',
contentDescription: 'Facebook sharing is easy!',
contentUrl: 'https://cabbazar.com',
},
}
shareLinkWithShareDialog() {
var tmp = this;
ShareDialog.canShow(tmp.state.shareLinkContent).then(
function(canShow) {
if (canShow) {
return ShareDialog.show(tmp.state.shareLinkContent);
}
}
).then(
function(result) {
console.log('handle result: ' + result);
},
function(error) {
console.log('Share fail with error: ' + error);
}
);
}
But I am always getting an error in my simulator. Do I need to setup anything in for Xcode?
I checked this url but it is not solving my problem.
null is not an object (evaluating 'ShareDialog.canShow')
Please suggest.
Thanks
Sometimes auto link doesn't work. So you have to link manually using react-native link react-native-fbsdk
The following Node.js code gives me error "Unhandled rejection Error: Invalid WSDL":
// Purpose: via node platform to access another system from my company
// This is the project url to get web service, already working on soapUI
var url = "https://w3(intranet-link)/webservices/ws_GetUserData.wss?wsdl";
var args = {
msg:"connecting!"
};
//define project access
var userid='';
var password='';
soap.createClientAsync(url).then((client) => {
//add project access to logon to url
client.setSecurity(new soap.BasicAuthSecurity(userid, password));
return client.MyFunctionAsync(args);
}).then((result) => {
console.log(result);
});
How can I fix this problem? Thank you!
I have a problem when created a new app in facebook and use it for sharing in Titanium with the Facebook Module , i get this error :
Error: HTTP status code: 403
[ERROR] : FB: The operation couldn’t be completed. (com.facebook.sdk error 5.)
So if i used my old (other) appid with the same code and and the same config in facebook apps section it works fine.
var fb = require('facebook');
fb.appid = "XXXXXXXXXXXXXXX";
fb.permissions = ['publish_stream', 'read_stream'];
if(!fb.loggedIn) {
fb.authorize();
}
var data = {
message: messageToShare,
picture: blobImageToShare
};
fb.requestWithGraphPath('me/photos', data, "POST", function(e){
if (e.success) {
Ti.API.info("FB: Success! Shared to FB: " + e.result);
}
else {
if (e.error) {
Ti.API.error('FB: '+ e.error);
}
else {
Ti.API.error("FB: Unkown result sharing");
}
}
});
Titanium version : 3.3.0
Titanium SDK 3.3.0
Platform & version : iOS >=6
Device: iOS simulator, iPhone 4 & 5.
any solution for this problem ?
You need to make sure the Facebook authorization completes before attempting to do a Graph query.
fb.authorize();
fb.addEventListener('login', function(e) {
Ti.API.debug('Returned from Facebook.');
if (e.success) {
Ti.API.debug('Authorized with Facebook, yeeey!');
// Query Graph now that we're authorized...
}
else if (e.error) {
Ti.API.debug('Error logging in with Facebook: ' + e.error);
}
else if (e.cancelled) {
Ti.API.debug('Cancelled logging in with Facebook.');
}
else {
Ti.API.debug('Something else. May actually be logged out.');
}
});
Also, make sure you define your Facebook appid in your tiapp.xml file:
<property name="ti.facebook.appid">xxxxxxxxxxxx</property>
I developing application in Titanium Appcelerator. I had share image to twitter using the social.js link..It was worked great till yesterday. and i dont know is there anything updated in api , my share is not working and my error states "Can't get Access token" .
MyCode:
var social = require('/ui/common/social_plus');
var twitter = social.create({
consumerSecret : '1bXxxxxxxxxxxxxxxxxT0raQbg2Bhx',
consumerKey : '3xxxxxxxxxxxxxxxffFx'
});
twitter.authorize(function() {
twitter.shareImage({
message : 'Share Via ',
image : pic_loc,
success : function() {
alert('tweeted Succesfully!');
},
error : function() {
alert("ERROR Tweeted!");
}
});
});
I am developing an iOS Application for collecting data following "FeatureLayerEditingSample"(you can find it here: FeatureLayerEditingSample).
I use Esri's iOS sdk version 10.2
This error occurs random sampling when I try to add a new feature (simple or with attachments) to my feature layer.
Moreover sometimes only one or two specific attachments cannot be sync and the error says "because unable to complete operation".
Any ideas?
When using REST API to add new feature, please make sure you do your request using POST and make sure you have included f and features parameters in the POST body.
Below is an example of the POST request in JavaScript(AngularJS) - it can be easily transferred to any other language:
$scope.addFeature= function(){
var url = "http://services6.arcgis.com/dD0xfCNJ6qLYAvCQ/arcgis/rest/services/US_Election_2016/FeatureServer/0/addFeatures";
var newFeature = {
"geometry" : {"x" : -122.504002, "y" : 45.448060},
"attributes" : {
"CandidateName" : "Hillary Clinton"
},
"spatialReference" : {
"wkid" : "4326"
}
};
var features = [];
features.push(newFeature);
var featuresString = JSON.stringify(features);
data = "f=json&features="+featuresString;
var config={
headers : {
'Content-Type' : 'application/x-www-form-urlencoded; charset=UTF-8'
}};
$http.post(url, data, config)
.then(
function(response){
console.log(response);
},
function(response){
console.log(response);
}
);
}
The problem was I was using a versioned database. Removing the version all worked again.