I am using firebase dynamic linking to send app invitation using email and sms gateway.
Basically, I am sending the invite code in deep link.
User who's installs with that invite code is connected to my user circle.
Now, I want to send invite code to my Facebook friends. Is there a way to send deep link through Facebook invite.
Following is the code to send the Facebook app invite:
#IBAction func showFacebookInvite(_ sender: AnyObject) {
let content = FBSDKAppInviteContent()
content.appLinkURL = URL(string: "https://fb.meXXXXX")
let obj = FBSDKAppInviteDialog()
obj.content = content
obj.delegate = self
let temp = FBSDKAppInviteDialog.validate(obj)
print(temp)
content.destination = .facebook
FBSDKAppInviteDialog
.show(from: self, with: content, delegate: self)
}
Any suggestions.
You can assign Firebase Dynamic Link to content.appLinkURL . When Facebook friend accepts the invite, friend will navigate to the link and install the App.
This should function identical to email/sms gateway.
To create short FDL links use iOS Builder API https://firebase.google.com/docs/dynamic-links/ios/create
Related
I have not been able to find a complete guide to creating a useful referral program in the Branch.io documentation. At the moment, I have the iOS SDK integrated as well as the dashboard setup correctly. I am using BranchUniversalObject and BranchLinkProperties and then showing the share sheet when a user attempts to share their referral yet when I click on the shared link, there is no reference to the user who referred the new user. I am setting a custom parameter referringUserID but that doesn't seem to get passed into the deep link when the user launches the app after download. I am also setting the canonicalIdentifier for the BranchUniversalObject. Is it better to generate a unique URL upon user account creation then use that from the share sheet and compare the +non_branch_link upon user launch? The code below is what I have for the current implementation of how we display the share sheet. What is the proper way to share links on iOS to track actual referrals?
let branchUniversalObject = BranchUniversalObject(canonicalIdentifier: Session.shared.userId!)
branchUniversalObject.title = "My Share Link"
branchUniversalObject.contentDescription = "Share"
// Feature (utm_medium) = marketing, referrals
// Channel (utm_source) = sticker, referral link, etc
// Campaign (itm_campaign) = launch, holiday season, etc.
// Tags = June Offer, Summer, Launch Promo
let branchLinkProperties = BranchLinkProperties()
branchLinkProperties.campaign = "Referral"
//branchLinkProperties.channel = "Referral Link"
branchLinkProperties.feature = "referrals"
branchLinkProperties.addControlParam("referringUserID", withValue: Session.shared.userId!)
branchUniversalObject.showShareSheet(
with: branchLinkProperties,
andShareText: "",
from: viewController,
completion: nil)
Is it possible to skip the following interstitial page when using Firebase Email Link Auth (passwordless)? Currently this page is shown regardless of whether the app is installed or not. I'd prefer to skip it and open the app directly if installed or else redirect to the App Store page.
Here's the code I'm currently using:
let actionCodeSettings = ActionCodeSettings()
actionCodeSettings.url = URL(string: linkToAppStorePage)!
actionCodeSettings.handleCodeInApp = true
actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
Auth.auth().sendSignInLink(toEmail: email, actionCodeSettings: actionCodeSettings) { error in
...
}
Prior to using Facebook SDK we used to share via UIActivityViewController since Facebook does not allow for us to pre-fill information on the user sharing, our solution was to use information the user description of the Image being share UIPasteboard.general.string. So the app would switch to the messenger and the user could paste. This worked just fine until we started using the Facebook SDK.
Now it seems that the UIPasteboard.general.string is reset when it opens up messenger and we no longer can get the image description copied to the clipboard.
This is how I'm sharing to messenger:
let sharePhoto = FBSDKSharePhoto()
sharePhoto.image = image
let content = FBSDKSharePhotoContent()
content.photos = [sharePhoto]
FBSDKMessageDialog.show(with: content, delegate: delegate)
Yes, I'm stacked on that staff too after FB lib update. As for me - I figured out with web link on image like it shown below. As a result - you do not need ask user to paste something. You can do it by yourself and paste it to title or description.
let content = LinkShareContent(url: url,
title: title,
description: description,
quote: nil,
imageURL: imageURL)
let dialog = ShareDialog(content: content)
dialog.presentingViewController = parentVC
dialog.mode = .automatic
dialog.completion = { result in
...
}
try? dialog.show()
Facebook is not support UI share both image and text. If you want to share an image and a text together, you can create a custom story from your app's settings, and share it as an open graph story. Here's the documentation.
I am trying to implement Open Graph Stories in iOS of facebook as shown in here: https://developers.facebook.com/docs/sharing/opengraph/ios#custom
I need to post it to facebook via custom interface, not with facebook share dialog.
So far, I can successfully create an open graph object per request, it does not return any error but does not post it to Facebook timeline neither. All I see in xcode is: postId: 113077439054125, completionGesture: post
I am not sure what goes wrong.
Here is my code snippet:
var photo = FBSDKSharePhoto(imageURL: imgUrl, userGenerated: false)
var properties : [NSObject : AnyObject] = [
"og:type" : "video.movie",
"og:title" : "TEST TITLE",
"og:image" : "https://www.facebook.com/images/fb_icon_325x325.png",
"fb:explicitly_shared" : true]
var object = FBSDKShareOpenGraphObject(properties: properties)
var shareApi = FBSDKShareAPI()
var action = FBSDKShareOpenGraphAction(type: "MYNAMESPACE:myAction", object: object, key: "movie")
var content = FBSDKShareOpenGraphContent()
content.action = action
content.previewPropertyName = "movie"
shareApi.delegate = self
shareApi.shareContent = content
shareApi.share()
I've been struggling with it for some time by now. Any help would be appreciated.
Thanks.
You should have solved it. If not, did you get the token for publish_actions permission?
This is how you can get it:
Go to Graph API Explorer.
Select your application.
Click "Get User Access Token".
Select "Extended Permissions" then "publish_actions".
Click "Get Access Token".
That's it.
You have to get your app approved by Facebook in order to gain publish_actions right? When you login to Facebook what are the different access permissions that it shows. Usually you will get a line in the Facebook permission page that says this app does not let you post to timeline or something like that.
What you can try is to create Test Users and use it to login. Test users get all the permissions that you ask for since they are separate from normal users. Note that these are not same as Testers which are still normal FB accounts.
Try using Test Users and once your app is ready to go live, send it to Facebook from the app dashboard and once approved by them you should be good to go live.
I use facebook sdk worked well except for delegate "sharerDidCancel:(id)sharer".
When i cancel my share with native dialog FB app, the delegate "sharer:(id)sharer didCompleteWithResults:(NSDictionary *)results" always called ? So i can't handle my users when they post or cancel the dialog share, is this a bug of Facebook SDK for IOS ?
Thanks for any helping!
I faced same issue during sharing in iOS 11. I have just changed native FB dialog to web dialog. As below:
Use below method:
dialog.mode = FBSDKShareDialogMode.feedWeb
instead of
dialog.mode = FBSDKShareDialogMode.native
Below is my code.It's work fine for me.
let content: FBSDKShareLinkContent = FBSDKShareLinkContent()
content.quote = "My Text"
content.contentURL = NSURL(string: String(format:"My Url"))! as URL!
let dialog: FBSDKShareDialog = FBSDKShareDialog()
dialog.fromViewController = self
dialog.shareContent = content
dialog.delegate = self
dialog.mode = FBSDKShareDialogMode.feedWeb
dialog.show()
I've just been digging through the Facebook SDK docs and found this:
sharer:didCompleteWithResults: when the user successfully shares. Furthermore there will also be a postId key in the results dictionary if the user gave the app publish_actions permissions. If that user has not logged in with Facebook Login, this method will also be called if the user clicks on Cancel.
So, unless you're logged in, checking cancel won't work (which is rubbish). Looks like you might be able to give some permissions and then check the postId though.
I found it is useful when you use FBSDKShareDialogModeWeb to share a link and FBSDKShareDialogModeNative to share a photo, then when you click cancel button, it will return to canceled delegate. But it only worked before iOS 9.1, and not support on iOS 9.1. I don't know why and how to solve it yet. Hope this answer is helpful.
I found a solution for this issue. Please match facebookdiplayname name in xcode plist and facebook developer account. If facebookdiplayname same then facebook delegate methods working right way.
I also have found that sharerDidCancel is never called when canceling.
You can do like Tejvansh suggested but checking if results is nil won't work because it's not nil when the user cancels, just empty.
The way I'm doing it is to check if the key "postId" exists, in which case the post was successful otherwise I assume the user canceled.
Swift example:
func sharer(sharer: FBSDKSharing!, didCompleteWithResults results: [NSObject : AnyObject]!) {
println("sharing results \(results)")
if results["postId"] != nil {
println("shared")
} else {
println("canceled")
}
}