Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Update Facebook for iOS SDK to version 14.0 #242

Open
frafersob opened this issue Jun 27, 2022 · 19 comments
Open

Update Facebook for iOS SDK to version 14.0 #242

frafersob opened this issue Jun 27, 2022 · 19 comments

Comments

@frafersob
Copy link

Since the release of the most recent version of the Facebook iOS SDK, it's impossible to track install events for iOS 14 or higher on Facebook's platform.

fberror

Please update this ASAP.

@frafersob
Copy link
Author

I also ask @SotoiGhost and @rmarinho if the project is abandoned, since it's been behind the official SDK for a few months.

@MateuszLas421
Copy link

MateuszLas421 commented Jun 29, 2022

#228

@kevin-hine-innis
Copy link

I attempted to update this to get events working with iOS 15.5, but I don't really know what I am doing (frankly).
You can find my fork here: https://github.com/kevin-hine-innis/FacebookComponents

My fork will build the nuget packages and samples with the 14.1.0 Facebook SDKs, and everything looks correct to me, but not everything works...
So I can't do a pull request because I can't update the API definitions.
Also I still can't log events on iOS 15.5 but it logs events on iOS 13.7. I have no idea if this is because my Nuget is bad, or because I am not interacting with Facebook correctly (perhaps a combination of both?).

You can see my implementation here: https://github.com/kevin-hine-innis/Xamarin.Facebook.IOS.CoreKit-SDK-14.1.0-Fail
That project already includes the 14.1.0 CoreKit nuget package.
If you know what I am doing wrong, please let me know. Big Thanks!

If you know Objective-C and are interested in helping me / the rest of us, please consider updating the API definitions.
See "Creating Bindings with Objective Sharpie": https://docs.microsoft.com/en-us/xamarin/cross-platform/macios/binding/objective-sharpie/

Maybe @SotoiGhost would be willing to help if he sees enough community effort to update this?

I simply have no experience with the Facebook SDKs and very little experience with Objective-C, so I'm pretty useless here.

@dominikhug
Copy link

I'm also waiting for a new version of the bindings supporting Facebook SDK version 14!!!

@maximfrisk
Copy link

This is a critical thing! waiting for an update as well... Is there any ETA?

@profilen
Copy link

profilen commented Sep 7, 2022

Any news?

@Luisalvarenga
Copy link

Any updates? 😢

@olivertech
Copy link

Hi everybody,,, Any news about this update ? I am trying to install 12.2.X version of Xamarin.Faceboo.iOS But I am getting dependency errors... If I install all the dependencies first, I cant install the main library.

I am getting this error:

Severity	Code	Description	Project	File	Line	Suppression State
Error Could not find a part of the path 'C:\Users\marcelo_oliveira\.nuget\packages\xamarin.facebook.sharekit.ios\12.2.0\lib\xamarinios10\Facebook.ShareKit.resources\FBSDKShareKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKShareKit.framework\Modules\FBSDKShareKit.swiftmodule\arm64-apple-ios-simulator.swiftdoc'.

Facebook/Meta is forcing us to update our app, to send user informations in a hash format, and to implement a hash logic, I need to reference the class FBSDKAppEvents But up to 9.0.1.5 version, this class doesnt exists.

So, If I try to update to 12.2.X, I came into this situation...

Error trying to update library to the last version OR a class missing in the version which I can install without error (9.0.1.5) !!!

We have an urgent demand to update our app, cause Facebook/Meta is obliging us to hash the user data, before send.

Please, anyone has a position about it ?

@AlejandroLemusR
Copy link

I attempted to update this to get events working with iOS 15.5, but I don't really know what I am doing (frankly). You can find my fork here: https://github.com/kevin-hine-innis/FacebookComponents

My fork will build the nuget packages and samples with the 14.1.0 Facebook SDKs, and everything looks correct to me, but not everything works... So I can't do a pull request because I can't update the API definitions. Also I still can't log events on iOS 15.5 but it logs events on iOS 13.7. I have no idea if this is because my Nuget is bad, or because I am not interacting with Facebook correctly (perhaps a combination of both?).

You can see my implementation here: https://github.com/kevin-hine-innis/Xamarin.Facebook.IOS.CoreKit-SDK-14.1.0-Fail That project already includes the 14.1.0 CoreKit nuget package. If you know what I am doing wrong, please let me know. Big Thanks!

If you know Objective-C and are interested in helping me / the rest of us, please consider updating the API definitions. See "Creating Bindings with Objective Sharpie": https://docs.microsoft.com/en-us/xamarin/cross-platform/macios/binding/objective-sharpie/

Maybe @SotoiGhost would be willing to help if he sees enough community effort to update this?

I simply have no experience with the Facebook SDKs and very little experience with Objective-C, so I'm pretty useless here.

Hello @kevin-hine-innis, have you found any alternative?
Or, has anyone had success trying to update the nugget locally?

@kevin-hine-innis
Copy link

Hello @kevin-hine-innis, have you found any alternative? Or, has anyone had success trying to update the nugget locally?

I have heard nothing more and I have not had time to revisit this.
My fork does build the packages though, so it might work if you want to try.
I'm like 80% that my build works (plus or minus any broken api definitions). My employer asked me to track installs from facebook campaigns, but I am not sure this works even with the official facebook SDKs (Apple changed the permissions requirements quite a lot). Eventually it just wasn't worth the time or money and we dropped it. So, I really have no further incentive to test this.

If someone could test my fork on iOS 15+ I would be willing to try updating the API definitions. Then I would feel confident making a pull request, or even releasing an unofficial nuget build.

@mos379
Copy link

mos379 commented Oct 12, 2022

As long as the pipeline is still private no one will pick up this project to update or fix this.
@SotoiGhost @rmarinho

@kur4mot0
Copy link

I'm having problem to use:
`if (Control == null)
{
var fbLoginBtnView = e.NewElement as FacebookLoginButton;
var fbLoginbBtnCtrl = new LoginButton
{
Permissions = fbLoginBtnView.Permissions
};

            fbLoginbBtnCtrl.Completed += AuthCompleted;
            SetNativeControl(fbLoginbBtnCtrl);
        }`

Error CS1061: 'LoginButton' does not contain a definition for 'Completed' and no accessible extension method 'Completed' accepting a first argument of type 'LoginButton' could be found (are you missing a using directive or an assembly reference?) (CS1061)

@dtaylorus
Copy link

Here's how you can use the latest Facebook SDK for iOS to track installs without having to depend on someone to update this Nuget package:

  1. Download and extract the latest FacebookSDK_Dynamic.xcframework.zip file from https://github.com/facebook/facebook-ios-sdk/releases
  2. Copy the FBSDKCoreKit_Basics.xcframework, FBAEMKit.xcframework, and FBSDKCoreKit.xcframework folders into a new NativeDependencies folder in your project.
  3. Add the following ItemGroup into your csproj file:
<ItemGroup>
	<NativeReference Include="NativeDependencies\FBSDKCoreKit_Basics.xcframework">
		<Kind>Framework</Kind>
		<SmartLink>False</SmartLink>
		<LinkerFlags>-ObjC</LinkerFlags>
	</NativeReference>
	<NativeReference Include="NativeDependencies\FBAEMKit.xcframework">
		<Kind>Framework</Kind>
		<SmartLink>False</SmartLink>
		<LinkerFlags>-ObjC</LinkerFlags>
	</NativeReference>
	<NativeReference Include="NativeDependencies\FBSDKCoreKit.xcframework">
		<Kind>Framework</Kind>
		<SmartLink>False</SmartLink>
		<LinkerFlags>-ObjC</LinkerFlags>
		<WeakFrameworks>Accelerate Accounts Social Security QuartzCore CoreGraphics UIKit Foundation AudioToolbox WebKit</WeakFrameworks>
	</NativeReference>
</ItemGroup>
  1. Add the files FacebookCoreKit.cs and FacebookApiDefinition.cs from https://gist.github.com/dtaylorus/0468be7372ba517db09c1bbfa68a927a
    (NOTE: These bindings are updated for .NET 6/7. See the previous revision of the Gist for older Xamarin.iOS project bindings.)
  2. Now you can use the Facebook CoreKit SDK as usual:
Facebook.CoreKit.ApplicationDelegate.InitializeSdk(options);
Facebook.CoreKit.ApplicationDelegate.SharedInstance.FinishedLaunching(application, options);

@Luisalvarenga
Copy link

@dtaylorus Thanks a lot for the tip, since I had the chance to use the code but i didn't work. I would like to know if you can give us more tips to get it work, in my case I made an attempt you can find it here: if you have the chance to look at it would be the best, thanks regards.

https://github.com/Luisalvarenga/FacebookSDKTestXamarin

@dtaylorus
Copy link

I created a sample project at https://github.com/hotchaipro/HotChai.Bindings. You will need to following the Getting Started instructions at https://developers.facebook.com/docs/ios/getting-started/ to configure the sample project with a Facebook App ID and client token in order to make the sample work.

@Luisalvarenga
Copy link

@dtaylorus It's interesting that we can actually set and use xcframeworks inside iOS projects, the example you shared works wonderful with all instructions taken but I am concerned that is being set up on net 7.0. Since I am using the old way xamarin.iOS I tried to make it work, but the only problem I encounter is that it crashes on the start up due to a no reference of a instance object, in case you can share more time you could check my example : https://github.com/Luisalvarenga/FacebookSDKTestXamarin-

@dtaylorus
Copy link

@Luisalvarenga Yes, you can use xcframeworks without a separate binding project. You're missing the xcframeworks in your linked project, though. You need to add the NativeDependencies folder containing the xcframeworks to your project.

As a side note for how I obtained the binding files, when you build a binding project you can inspect the obj folder to find the actual C# bindings generated by the build process. You can also just copy the disassembled source code by installing an older version of the Nuget and inspecting the assembly since the bindings don't change very often and work just fine with newer frameworks. I simply copied these files into my project so I could use the xcframeworks directly and get the latest native releases. You can still create a separate binding project if you like, but it seems like unnecessary overhead to me. And in my opinion it's much easier to fix up the actual C# binding code if it's generated incorrectly than it is to try to apply XML transforms to the obscure intermediate binding language as recommended in binding projects.

If you can, I do recommend you move to .NET 6+ since a lot of Nuget packages being actively maintained are moving forward and not providing backward compatible Xamarin.iOS versions.

Good luck!

@ediwnroy
Copy link

Has anyone found a solution for the "Error Could not find a part of the path" error. ?

@AlexeyStarkov
Copy link

Here's how you can use the latest Facebook SDK for iOS to track installs without having to depend on someone to update this Nuget package:

  1. Download and extract the latest FacebookSDK_Dynamic.xcframework.zip file from https://github.com/facebook/facebook-ios-sdk/releases
  2. Copy the FBSDKCoreKit_Basics.xcframework, FBAEMKit.xcframework, and FBSDKCoreKit.xcframework folders into a new NativeDependencies folder in your project.
  3. Add the following ItemGroup into your csproj file:
<ItemGroup>
	<NativeReference Include="NativeDependencies\FBSDKCoreKit_Basics.xcframework">
		<Kind>Framework</Kind>
		<SmartLink>False</SmartLink>
		<LinkerFlags>-ObjC</LinkerFlags>
	</NativeReference>
	<NativeReference Include="NativeDependencies\FBAEMKit.xcframework">
		<Kind>Framework</Kind>
		<SmartLink>False</SmartLink>
		<LinkerFlags>-ObjC</LinkerFlags>
	</NativeReference>
	<NativeReference Include="NativeDependencies\FBSDKCoreKit.xcframework">
		<Kind>Framework</Kind>
		<SmartLink>False</SmartLink>
		<LinkerFlags>-ObjC</LinkerFlags>
		<WeakFrameworks>Accelerate Accounts Social Security QuartzCore CoreGraphics UIKit Foundation AudioToolbox WebKit</WeakFrameworks>
	</NativeReference>
</ItemGroup>
  1. Add the files FacebookCoreKit.cs and FacebookApiDefinition.cs from https://gist.github.com/dtaylorus/0468be7372ba517db09c1bbfa68a927a
    (NOTE: These bindings are updated for .NET 6/7. See the previous revision of the Gist for older Xamarin.iOS project bindings.)
  2. Now you can use the Facebook CoreKit SDK as usual:
Facebook.CoreKit.ApplicationDelegate.InitializeSdk(options);
Facebook.CoreKit.ApplicationDelegate.SharedInstance.FinishedLaunching(application, options);

Thank you for your tips! Since more than two years passed, is there a chance you show us the ApiDefinition classes for other libraries (LoginKit, ShareKit, etc) targeting Xamarin.iOS?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests