xamarin / FacebookComponents

MIT License
88 stars 70 forks source link

Update Facebook for iOS SDK to version 14.0 #242

Open frafersob opened 2 years ago

frafersob commented 2 years ago

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 commented 2 years ago

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

MateuszLas421 commented 2 years ago

228

kevin-hine-innis commented 2 years ago

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 commented 2 years ago

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

maximfrisk commented 2 years ago

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

profilen commented 2 years ago

Any news?

Luisalvarenga commented 1 year ago

Any updates? 😢

olivertech commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

kur4mot0 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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