Dynamic Links not working iOS 15.1 Facebook Swift - swift

Firebase Dynamic Links not working iOS 15.1 for Facebook but working perfectly iOS 14.1. I have tried lot of changes with Dynamic Link parameters. I have checked all parameter configured correctly in the Firebase account and Dynamic link like App BundleId, AppStoreID, AppID and all others parameters.
For iOS 14.1
User post a dynamic link on facebook as a post. When user click on then facebook post redirect to automatically in the app.
For iOS 15.1
User post a dynamic link on facebook as post. When user click on facebook post, the user redirect default Website which i set in the dynamic link url.
User post a dynamic link on facebook as post. When user click on facebook post, the user redirect default Website which i set in the dynamic link url.
Code:-
func createLinkShare1(dynamicLinksDomainURIPrefix:String,link:URL) {
let appBundleID = AppInformation.AppBundleId
if let linkBuilder = DynamicLinkComponents(link: link, domainURIPrefix: dynamicLinksDomainURIPrefix) {
linkBuilder.navigationInfoParameters = DynamicLinkNavigationInfoParameters()
linkBuilder.navigationInfoParameters?.isForcedRedirectEnabled = true
linkBuilder.iOSParameters = DynamicLinkIOSParameters(bundleID: appBundleID)
linkBuilder.iOSParameters?.appStoreID = AppInformation.AppStoreId
linkBuilder.iOSParameters?.minimumAppVersion = AppInformation.AppMinimumVersion
linkBuilder.androidParameters = DynamicLinkAndroidParameters(packageName: appBundleID)
linkBuilder.androidParameters?.minimumVersion = 0
linkBuilder.socialMetaTagParameters = DynamicLinkSocialMetaTagParameters()
linkBuilder.socialMetaTagParameters!.title = "Testing "
linkBuilder.socialMetaTagParameters!.descriptionText = "Invite You"
guard let longDynamicLink = linkBuilder.url else {
print("ERROR in linkBuilder")
return
}
DynamicLinkComponents.shortenURL(longDynamicLink, options: nil) { url, warnings, error in
if let error = error {
print("error shortening link: \(error.localizedDescription)")
return
}
if let url = url {
print("Share Url = ",url)
return
}
}
}
}
Firebase Dynamic Links not working Every Time Open Custom WebView (Redirection issue) Swift
Please check above code and let me know if i'm doing wrong anything, please correct me.
Can someone please explain to me how to show popup or deep working as expected in the Facebook case in the iOS 15., I've tried to with above code but no results yet.
Any help would be greatly appreciated.
Thanks in advance.

Related

How capture the facebook fbclid and forward it to the client with a button click

We're testing a new tracking method and want to pass the Facebook fbclid on to the client.
Just to be clear...
The user clicks the Facebook ad,
They land on our page
They click a button and are taken to the client
How can we capture the fbclid and forward it on to the client when the user clicks the button on our page?
I added the following code. Which included adding a class to the link. Will check to see if it works.
let anchors = document.getElementsByClassName("marketingAnchor")
Array.from(anchors).forEach(element => {
let currentURL = new URL(window.location.href)
let AnchorHref = element.getAttribute('href')
let tmpURLObj = new URL(AnchorHref)
let fbclidParam = currentURL.searchParams.get("fbclid")
if (AnchorHref == null || fbclidParam == null) return;
tmpURLObj.searchParams.set('fbclid', fbclidParam);
element.setAttribute('href', tmpURLObj.href)
});</script>

Preview is not available in sharing to Facebook with Firebase Dynamic Link

I have created a shorten dynamic link with Firebase. When I share the link to Facebook, the preview is not available. I have tried with the long link. It's not working either. I have provided the link with metadata. But is is not showing the preview.
This is the code I am using now.
FirebaseDynamicLinks.getInstance().createDynamicLink()
.setLongLink(Uri.parse(longLink))
.setIosParameters(new DynamicLink.IosParameters.Builder(getPackageName()).build())
.setAndroidParameters(new DynamicLink.AndroidParameters.Builder(getPackageName()).build())
.setSocialMetaTagParameters(
new DynamicLink.SocialMetaTagParameters.Builder()
.setImageUrl(Uri.parse(demoPhoto))
.setImageUrl(Uri.parse(itemsVO.getThumbnail().get(0)))
.build())
.buildShortDynamicLink(ShortDynamicLink.Suffix.SHORT)
.addOnCompleteListener(this, task -> {
if (task.isSuccessful()) {
// Short link created
Uri shortLink = task.getResult().getShortLink();
itemsVO.setShareLink(shortLink.toString()+"?d=1");
shareBtn.setVisibility(View.VISIBLE);
} else {
// Error
Toast.makeText(this, "Error in creating dynamic link", Toast.LENGTH_LONG).show();
// ...
shareBtn.setVisibility(View.GONE);
}
});
Can anyone tell me why it is not working?

i need help in adding facebook share into my ios application

i am trying to add facebook share dialog into my ios application and i found the official page from facebook on how to do it, but i run into a problem about ContentProtocol. i dont know what that is. here is the link to the guidence that i use . it is pretty straight forward. basically just install the pod facebookshare, import it and add few line of code, but i got problem on 'myContent'
here is the code
import FacebookShare
let shareDialog = ShareDialog(content: myContent)
shareDialog.mode = .Native
shareDialog.failsOnInvalidData = true
shareDialog.completion = { result in
// Handle share results
}
try shareDialog.show()
here is the link
https://developers.facebook.com/docs/swift/sharing/share-dialog
what should i put in the myContent?
I guess next link is explained what you can use as content and how to use it
Content-types
(From documentation) Currently, the Facebook SDK for Swift can share 4 different kinds of content:
Links - Represented by the LinkShareContent object.
Photos - Represented by the PhotoShareContent object.
Videos - Represented by the VideoShareContent object.
Open Graph - Represented by the OpenGraphShareContent object.
you can use FBSDKShareLinkContent
let content : FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: "//URL")
content.contentTitle = "MyApp"
content.contentDescription = "//Desc"
content.imageURL = NSURL(string:"//Image URL")

How to show the path of a workout using Facebook Open Graph Stories in iOS - Result is different on Facebook App versus iPhone Browser

I have this code to share workout data on Facebook. My intention is to eventually show a path of the run/walk. But I have this confusion at the moment. If I execute this code and look at my Facebook page on either iOS Facebook App, or any browser on a computer (Mac for example) I see only the distance and some other information. But when I look at my post on a browser on an iOS device (logged in my Facebook account on either Safari or Chrome on iPhone) I see a map (See images attached). My question is why is there a difference on the look of the post depending on how I view it? And how can I show the map on the post to the Facebook App? I am using the latest Facebook SDK for iOS: Version 4.28.0
func shareOnFacebook () {
// Create an object
let properties = ["og:type": "fitness.course",
"og:title": "Title",
"og:description": "Description",
"fitness:duration:value": 1200,
"fitness:duration:units": "s",
"fitness:distance:value": 4.3,
"fitness:distance:units": "mi",
"fitness:metrics:location:latitude": 36.9926439,
"fitness:metrics:location:longitude": -102.0419088,
"fitness:metrics:location:altitude" :42,
"fitness:metrics:timestamp" :"2017-11-18T00:00",
"fitness:metrics:distance:value" : 0,
"fitness:metrics:distance:units":"mi" ,
"fitness:metrics:pace:value" :0,
"fitness:metrics:pace:units" :"s/m",
"fitness:metrics:calories":0] as [String : Any]
let object = FBSDKShareOpenGraphObject(properties: properties)
// Create an action
let action = FBSDKShareOpenGraphAction()
action.actionType = "fitness.run"
action.setObject(object, forKey: "fitness:course")
// Create the content
let content = FBSDKShareOpenGraphContent()
content.action = action
content.previewPropertyName = "fitness:course"
let shareDialog = FBSDKShareDialog()
shareDialog.fromViewController = self
shareDialog.shareContent = content
if shareDialog.canShow() {
shareDialog.show()
}
}

Can I make an app available only to people that like a facebook page? [duplicate]

This question already has answers here:
How to check if a user likes my Facebook Page or URL using Facebook's API
(5 answers)
Closed 9 years ago.
I have made a facebook App and associated with a page. I only want people that like the page to be able to use the app. Is this possible?
When somebody tries to load your app, they will need to be authorised.
Once authorised, you can query the user's graph to see what they like:
(I've assumed you've authorised using the php sdk, and will have the $facebook object, however the principle is the same for other techniques)
$fanPageId = "xxxxxxxxx";
$appId = "xxxxxxxxxx";
$fanPageLiked = false;
$appLiked = false;
$likes = $facebook->api('me/likes');
foreach ($likes['data'] as $ilike) {
if ($ilike['id'] == $fanPageId) {$fanPageLiked = true;}
if ($ilike['id'] == $appId) {$appLiked = true; }
}
if ($fanPageLiked)
{
.... run your game.
}
else
{
.... redirect to fan page.
}