Reputation: 379
i created an app using react-native ini projectName
and i added a native module package called react-native-facebook-account-kit
And i need to change Info.plist in ios folder and add app id and client token info. Also i created a pod file as facebook docs said.
It works fine. Then i tried to make exactly same thing in expo.
So i used this cli to create a new project
create-react-native-app projectName
then i run npm run eject
and selected second option which is uses both react-native and expo sdk.
So it created ios and android folders successfully.
BUT in ios folder there is no Info.plist file. After my search i found this doc.
https://docs.expo.io/versions/latest/workflow/configuration#ios
And i added some key and values into app.json
like doc said.
{
"expo": {
"sdkVersion": "27.0.0",
"ios": {
"bundleIdentifier": "com.cecil.foxtail",
"infoPlist": {
"FacebookAppID": "myAppId",
"AccountKitClientToken": "myClientToken",
"CFBundleURLTypes": [
// ??? CONFUSED
]
}
},
"android": {
"package": "com.cecil.foxtail"
}
}
}
Here is the original Info.plist from the app which is working great.
<key>FacebookAppID</key>
<string>{app-id}</string>
<key>AccountKitClientToken</key>
<string>{client-token}</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>ak{client-token}</string>
</array>
</dict>
</array>
So how to define these array into app.json ?
Upvotes: 2
Views: 1818
Reputation: 11
You don't need to set a custom URL Schema because expo by default sets it to your bundleIdentifier
"bundleIdentifier": "com.cecil.foxtail",
So you can call your app from another by calling something like this:-
let websiteUrl ="https://apps.apple.com/myappInstallationPage";
let SchemaUrl = 'com.cecil.foxtail://';
Linking.canOpenURL(SchemaUrl).then(supported => {
if (supported) {
console.log('accepted');
return Linking.openURL(SchemaUrl);
} else {
console.log('an error occurred');
}
}).catch(err => {
Linking.openURL(websiteUrl).catch(reason => console.log('Failed to open app website!'))
console.log('an error occurred')
});
Hope it helps.
Upvotes: 0