I have problem sharing a link on Facebook in my app made with Appcelerator
I’m using iOS 11 Simulator, Titanium SDK 7.1 and Facebook Module 5.8.
My tiapp.xml should be correct.
The facebook app is not installed on the simulator.
My code is:
var fb = require('facebook');
fb.initialize();
function shareLink() {
fb.addEventListener('shareCompleted', onShareCompleted);
fb.presentShareDialog({
link: "http://www.google.com"
});
}
function onShareCompleted(e){
fb.removeEventListener('shareCompleted', onShareCompleted);
if (e.success) Ti.API.info('Share request succeeded.');
else Ti.API.info('Failed to share.' + JSON.stringify(e));
}
When I try to share, the app show me a webpage of facebook with the error “The parameter ‘href’ or ‘media’ is required”.
If I switch the Facebook module from version 5.8 to 5.6, the first time I try to share, it fails, but the second time it work!
I can’t understand where I’m wrong.
Thanks for any help!
Try this. Its super easy and I always use it for social sharing:
https://github.com/ricardoalcocer/socialshare/tree/master/app/widgets/com.alcoapps.socialshare
Related
I am trying to share a link from my react-native iOS app. But when I click the button to share, my app becomes unresponsive.
I am tried using both the code mentioned below, but nothing worked -
Share.share({
message:
this.props.app_urls.share + "\n" + this.props.app_urls.link_download
});
or
Share.share({
message:
this.props.app_urls.share,
url : this.props.app_urls.link_download
});
The same code works fine in android but its not working for iOS.
What can I do to make it working?
You can use react-native-share, I have used it without any issues.
You can use it like this [COPIED]
import Share from 'react-native-share';
const shareOptions = {
title: 'Share via',
url: 'some share url',
social: Share.Social.WHATSAPP }; Share.shareSingle(shareOptions);
Update:
The issue is still open on github, try using timeout, this will resolve the issue for now.
I'm trying to set the Facebook's AppId from code, so I can choose to which app to connect to (between 2 apps, one of them is a test app).
Basically I'm looking for an equivalent for Android's SDK call:
FacebookSdk.setApplicationId(ACTIVE_APP_ID);
I'm aware of the deprecated iOS call:
[FBSettings setDefaultAppID:ACTIVE_APP_ID];
But can't seem to find alternative to it.
I'm using SDK ver 4.22.1. Thanks!
FacebookSDK v4.44.1 swift 5 - Set the Facebook App ID used by the SDK:
Settings.appID = "YOUR-FACEBOOK-APPLICATION-IDENTIFIER"
Settings.displayName = "YOUR-FACEBOOK-DISPLAY-NAME"
That's the way I have managed to set it programmatically and override the default settings at the info.plist file.
Maybe you can try :
[FBSDKSettings setAppID:ACTIVE_APP_ID];
(I am using version 4.29.0 of FBSDK).
I'm going through the docs in React Native and can only find navigating to external links from the app I am in.
I want to be able to navigate to the Settings app (more specifically to the privacy > location services page) but, can not seem to find the necessary information on it. There is the native iOS way of doing it which I am trying to replicate through React Native.
Is this possible?
I have tried the following to detect if there is a Settings URL. The console logs that the Settings url works however, it does not navigate to that page.
Update: thanks to #zvona I am now navigating to the settings page but not sure how to get to a specific deep link.
Linking.canOpenURL('app-settings:').then(supported => {
console.log(`Settings url works`)
Linking.openURL('app-settings:'
}).catch(error => {
console.log(`An error has occured: ${error}`)
})
You can access settings of the application with:
Linking.openURL('app-settings:');
But I don't know (yet) how to open a specific deep-link.
2021 update use:
Linking.openSettings();
otherwise your app will be rejected due use of non-public URL scheme
I successfully opened the settings by the code below, hope it's helpful :)
Linking.canOpenURL('app-settings:').then(supported => {
if (!supported) {
console.log('Can\'t handle settings url');
} else {
return Linking.openURL('app-settings:');
}
}).catch(err => console.error('An error occurred', err));
Reference: https://facebook.github.io/react-native//docs/linking.html
Since React Native version 0.59 this should be possible using openSettings();. This is described in the React Native Linking documentation. Although it did not work for me. When I tried quickly I saw a _reactNative.Linking.openSettings is not a function error message.
Linking.openSettings();
You can deep-link referencing the settings's index like so:
Linking.openURL('app-settings:{index}')
For example Linking.openURL('app-settings:{3}') would open the Bluetooth settings.
Linking.openURL('app-settings:1');
Adding an answer that worked for me and is easy to apply.
openSettings function in #react-native-community/react-native-permissions works for both iOS and Android.
Calling openSettings function will direct the user to the settings page of your app.
import { openSettings } from 'react-native-permissions';
openSettings();
You can import Linking from 'react-native' and then use Linking.openSettings() to trigger the call. This link explains it very concisely:
https://til.hashrocket.com/posts/eyegh79kqs-how-to-open-the-settings-app-in-reactnative-060
For example: to navigate under Settings/Bluetooth you have to use Linking.openURL('App-Prefs:Bluetooth');
For iOS 14 and ReactNative 16.13
You can use the most easiest way to open the app setting from react-native.
just,
import { Linking } from 'react-native';
and user below line anywhere you want open the app setting.
Linking.openSettings();
Old question, but this didn't work for me on Android and I found something that did. Hope this helps anyone looking for the same. :)
https://github.com/lunarmayor/react-native-open-settings
I don't have the ability to test it for iOS though.
Opens the platform specific settings for the given application.
You can handle your case using Linking from react-native. In my case, I accessed the touch id settings on IOS using:-
Linking.openURL('App-Prefs:PASSCODE');
we have migrated a worklight 6.1 application t IBM mobilefirst 7.0 platform and all the functionalities working as expected on the android environment, but in ios we are facing an issue: there is a function called "quick receipt". on click on a button the device camera opens and a photo is taken. The problem is that the photo is not displaying - it returns complete blank page this issue on ios device only but not on Android device.
Camera.DestinationType.FILE_URI is not working on IOS.
for security reason we wont share the code. here is similar prototype code.
html
<div><img alt="QuickReceipts" src="resources/img/camera.png" onclick="imgCapture();"</div>
JavaScript
imgCapture: function (){
navigator.camera.getPicture(this.onSuccess, this.onFail,{quality:80,destinationType:Camera.DestinationType.FILE_URI, targetWidth:600,targetHeight:1050}
},
onSuccess:function(imgData)
{
// applying the css and displaying the img
$("#imgReceipt").attr("src","data:image/jpeg;base64," +imgData);
$("#imgReceipt").css("display", "block");
}
onFail:function(imgData){
// failure msg
}
One suggestion is to attempt to code change as mentioned by Nazmul: http://www.telerik.com/forums/ios-cordova-3-5-0-camera-getpicture-targetwidth-issue.
Another suggestion is to upgrade to the latest 7.1 iFix from IBM Fix Central which contains several Cordova corrections and may address your issue.
If your issue is not resolved still, I suggest to open an IBM PMR (support ticket).
Could not find information. I built pg app with 'cordova-plugin-wkwebview-engine'.
How to check if phonegap web app on ios 9.2 is really using WKWebview? Could not find info how userAgent string should look like for WKWebView.
Previous answer doesn't work on iOS 10, but you can use this code
if (window.webkit) {
//WKWebView
}
Old answer:
You can check for indexedDB
if (window.indexedDB) {
//WKWebView
}