[AC-1682] Ti.Facebook restarts application on sucessful share
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2016-01-28T06:08:06.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | facebook, ios, mobilesdk |
Reporter | Adipa Wijayathilaka |
Assignee | Sharif AbuDarda |
Created | 2016-01-25T17:30:05.000+0000 |
Updated | 2016-03-08T07:38:10.000+0000 |
Description
test case:
1. Make sure the proper properties are set:
https://github.com/appcelerator-modules/ti.facebook/blob/master/ios/README.md
2. Initialize facebook:
var FB = require('facebook');
var shareParams = {
link: URL,
title: TITLE,
description: " ", //deprecated
picture: PIC_URL
};
//FB.display = "popup";
//FB.appid = Alloy.CFG.facebookProperties.appid;
//FB.permissions = Alloy.CFG.facebookProperties.permissions;
//FB.forceDialogAuth = true;
FB.initialize();
FB.addEventListener('shareCompleted', function (e) {
if (e.success) {
Ti.API.info('FB - Share request succeeded.');
} else {
Ti.API.warn('FB - Failed to share.');
Ti.API.warn(e.error);
}
});
FB.presentShareDialog(shareParams);
3. Successfully share data (confirmed this works)
At this point the phone quits out of the facebook app and *restarts* the application. On Android it returns back to the application at its previous state correctly.
Also note the shareCompleted event never fires even though the share successfully goes through.
Any help would be appreciated, any ideas why this would be the case? There are *no errors* reported on the console when this happens, for all intents it appears the app completely restarts.
Hello, I tried to test the project with Ti.Facebook with the below code. This is working as expected. The share works and also the share success alert shows.
Environment
MacOS X 10.10.5 Ti SDK 5.1.2.GA iOS 9.2 Ti.Facebook 5.0.0Code
Did you follow the steps for configuring facebook module in [documentation](http://docs.appcelerator.com/platform/latest/#!/api/Modules.Facebook-method-presentShareDialog) link?. Please provide the log and your ios section of in tiapp.xml file. Thanks.
The strange part about all this is it doesn't give any errors! The share goes through (i.e I can see the share post on the facebook wall). However the issue here is that it doesn't fire the sharecomplete event AND it restarts the app, again without errors on iOS. The only thing different from my configuration from the appcelerator docs/github's readme is I'm not 100% on the FacebookDisplayName in the ios plist. Going to try redo all of it just in case I missed something see if it still occurs, will be back in a bit with the results.
First of all sorry for the delay, I thought I had it solved by just rewriting it but it appears it is NOT an issue with ios9, it IS an issue with iOS 8.3 (iphone 5s). Again sorry about that I mixed up my iOS versions. This is my config:
and my tiapp.xml (condensed to the relevant sections):
It shares successfully but closes and restarts the app. EDIT: I've put the code here https://gist.github.com/boarnoah/366ebd76ff5c5ad3865e since Jira's syntax highlighter is hard to work with. EDIT2: The issue persists whether or not the device has the Facebook app installed.
Hello, I see you didn't provide the FB app name in your tiapp.xml. See the below ios section of tiapp.xml
Now,
Here you put the facebook app id with addition to 'fb' at first.
Now, here in the first string tag you provide only the facebook app id and in the second string tag you provide the name of the app. Lets say your FB app display name is "AppcNew". So you put the exact name here. Thanks.
Sorry for the confusion: (line numbers below correspond to https://gist.github.com/boarnoah/366ebd76ff5c5ad3865e line 16 is fb + app id(from developer.facebook.com) line 22 is app id (developer.facebook.com) line 25 is app name (developer.facebook.com) I just replaced them with X or "FB Mobile App Name" for the purposes of example code. Again, I'm fairly sure this code works because it executes and shares fine on iOS 9.0 (both with and without the fb app installed) and android. It even works correctly with iOS 8, it shares the message successfully BUT it closes and restarts the app without error messages which is the issue. Sorry if I wasn't too clear with my example code. EDIT: I managed to capture an error message by launching it on the iOS simulator (iphone 6 plus iOS 8.1 and using this; tail -f ~/Library/Logs/CoreSimulator/*/system.log The captured message: