Jump to content
Chris Pim

Linking errors with FacebookAudienceNetwork

Recommended Posts

Hi all,

 

I've been trying to integrate Facebook Audience Network into my Firemonkey app for ads and I'm getting a very strange error when linking for iOS.

 

I use the "fake loader" approach to linking the framework.

const
  libFBSDKCoreKitBasics = 'FBSDKCoreKit-Basics.framework/FBSDKCoreKitBasics';  //required as it's a dependency for the FBAN library
  libFBAudienceNetwork = 'FBAudienceNetwork-5.2.0.framework/FBAudienceNetwork';  

function LibFBCoreKitBasics: Pointer; cdecl;   external libFBSDKCoreKitBasics name 'OBJC_CLASS_$_FBSDKURLSessionTask';
function LibFBAN: Pointer; cdecl;   external libFBAudienceNetwork name 'OBJC_CLASS_$_FBNativeAdView';

The error when I try to link, is this:

 

  ld: file is universal (4 slices) but does not contain a(n) arm64 slice: ..\Libraries\FBAudienceNetwork-5.2.0.framework/FBAudienceNetwork for architecture arm64

 

I've Googled and the only reference to this kind of error is related to armv7 when trying to link frameworks into a 64bit app that only contain 32bit versions. So I try building a 32bit version of my app in Delphi and see:

 

  ld: file is universal (4 slices) but does not contain a(n) armv7 slice: ..\Libraries\FBAudienceNetwork-5.2.0.framework/FBAudienceNetwork for architecture armv7

 

Which doesn't make any sense! It looks like the FBAudienceNetwork framework is essentially empty with neither 32 or 64bit code which can't be true as it's 1.7Mb and fresh from the official download page.

I've tried different versions of the framework but get the same error each time so I've ruled out a corrupted download.

 

I've tried linking through the "Linker Options" in the project settings instead but get the same errors.

Linking the FBSDKCoreKit libraries works using the same approach.

 

Does anyone have any ideas or know why I'm getting this error?

 

Thanks in advance!

Share this post


Link to post

Thanks Dave, I’m glad you saw the same. Thanks for reporting it for me too, I’ve voted for it so hopefully it’ll be looking into.

Share this post


Link to post
2 hours ago, eg1 said:

Also jvesoft have Admob and Facebook Audience component but I don't understand how he is added this framework successfully

Given that the instructions are to include the framework with the project, I assume he is loading it dynamically. If I have time, I'll give it a shot myself, however if you have this file:

 

  https://github.com/DelphiWorlds/Kastri/blob/master/API/DW.iOSapi.FBAudienceNetwork.pas

 

Replace the implementation section with:

uses
  Posix.Dlfcn;

var
  FANModule: THandle;

// procedure FBAudienceNetworkLoader; cdecl; external libFBAudienceNetwork; // <---- Uncomment this if using static binding

initialization
  FANModule := dlopen(MarshaledAString(libFBAudienceNetwork), RTLD_LAZY);

finalization
  dlclose(FANModule);

end.

You'll still need to follow the instructions on the jvesoft site regarding signing/deploying FBAudienceNetwork

 

Good luck! 🙂

 

  • Like 1

Share this post


Link to post

Don't know about JveSoft, but that looks interesting.

JveSoft seems to add a whole lot of critical frameworks, are you sure they were all needed for your function ?

How is JveSoft sourcecode structured, can parts of the sooftware be easily separated, or do you need to use all or nothing ?

I would always try to minimize the critical frameworks, if possible.

  • Like 1

Share this post


Link to post

If you purchase the JVE ad component you get the sources so I suggest doing that if you’d like to see how Yegor has done it. It’s probably a fair thing to do if he’s put all the effort into figuring it out.

But I can confirm that he is loading the framework at runtime but not in the way David says as that also fails to link.

He’s loading the framework file directly from the bundle and invoking the initialiser at runtime. This means that the framework has to be deployed with your app and signed separately with the same provisioning profiles before it’s included as per his instructions. It works locally but when I tried to upload a sample app to TestFlight it raises errors from the App Store because you’re embedding a third party binary and the store isn’t a fab of doing this.

 

I’m sure it’s all solvable but I haven’t had any time to look into it as I had to abandon Audience Network for now.

 

hope this helps

Share this post


Link to post
39 minutes ago, Rollo62 said:

JveSoft seems to add a whole lot of critical frameworks, are you sure they were all needed for your function ?

Just to confirm, you don’t need most of the frameworks mentioned in the JVE Manual. It assumes you’re going to be installing all their components from the suite which require different dependencies. For FBAN and Abmob I think you only need some of them but I couldn’t easily tell you which ones.

  • Like 3

Share this post


Link to post
47 minutes ago, Chris Pim said:

TestFlight it raises errors from the App Store because you’re embedding a third party binary and the store isn’t a fab of doing this

Which would invalidate using the "solution" from jvesoft. Surely they have complaints about it?

  • Like 1

Share this post


Link to post
43 minutes ago, Dave Nottage said:

Which would invalidate using the "solution" from jvesoft. Surely they have complaints about it?

I honestly don't know. To be honest, I didn't spend enough time on it to figure out whether it was a fundamental problem with having the framework embedded, just the way I was implementing it, or maybe I signed the framework incorrectly. My app uses iOS widgets too so I have to re-sign after Delphi has built it to apply the extra provisioning profiles which made things a lot more complicated and could have contributed to the errors I received.

If I get time, I'll create a simple app which uses his components and try to upload again so I can try with something simpler and see if the same errors appear.

  • Like 1

Share this post


Link to post

I tested JVE FAN, its working (with sing and deploy dynamic library). But I have another problem

 

I'm trying Admob Mediation, I have too add admob facebook adapter sdk (https://bintray.com/google/mobile-ads-adapters-ios/FacebookAdapter)

But when added this adapter its requesting FAN SDK and we can not add FAN SDK.

also I tried to sign and deploy adapter sdk but deployment failed, I think adapter sdk not suitable to sign and deploy. (I dont know which sdks can be sign and deploy or not )  

 

is there any way to use Admob Mediation Facebook? thank you for any tip and helps

https://developers.google.com/admob/ios/mediation/facebook

Share this post


Link to post
7 hours ago, eg1 said:

I tried to sign and deploy adapter sdk but deployment failed

What were the errors?

  • Like 1

Share this post


Link to post
7 hours ago, Dave Nottage said:

What were the errors?

"Unable to install package (e800801x)"

 

I sign and deploy FAN SDK without problem, JVEsuit have tutorial for this process.

I tried same to google adapter sdk but failed when I try the compile after add signed files to deployment. This error about wrong sign but I did correct (same sign pipeline is worked on fan sdk)

 

untitled.thumb.png.e9f758f22c9d168f4e7a91297552dd9d.png

 

 

also I deleted extra architectures (simulator arch) in FacebookAdapter with "lipo FacebookAdapter -remove x86_64 -remove i386 -output FacebookAdapter" (Yegor Kurbachev helped for this), but still I can not deploy this signed sdk.

 

-----------

 

also I tried different way, I added to linker "-weak_framework FBAudienceNetwork -framework FacebookAdapter" (FBAudienceNetwork is dynamic here) compile and link successfully. Application dosen't crash on start because of "weak_framework" but FBAudienceNetwork loading probly failed on background also I added JVEsuite FAN SDK with sign and deploy (I check logs JVEsuite FAN SDK initialize successfully) but I don't know google adapter used which one 🙂 and can not test, facebook ads only delivering when your apps live (publisher told me like that), I hope this will work this is my last hope.

 

 

 

 

 

 

Share this post


Link to post
1 hour ago, eg1 said:

Unable to install package (e800801x)

There's no such error message, since x is an invalid hex character. Please provide the exact error message.

Share this post


Link to post
9 hours ago, Dave Nottage said:

There's no such error message, since x is an invalid hex character. Please provide the exact error message.

this messsages change and X for this, now I got this error;

The following error was returned: 'Unable to install package. (e8000051)'

 

Share this post


Link to post
23 minutes ago, Rollo62 said:

Maybe that helps, suggest something with hardware ?

https://becomethesolution.com/blogs/iphone/install-incompatible-ios-apps

fb_error.thumb.png.3c0bf92968b6fa00f73eb9c5112d4d89.png

 

when uncheck FacebookAdapter files, compile and link successfully. I think this sdk files have problem. 

I check lipo -info, only 2 arch inside "armv7 arm64" should I remove armv7? 

 

My .info.plist UIRequiredDeviceCapabilities like that, should I edit this?

Thank you, I don't expert all this things just trying to fix this problem

<key>UIRequiredDeviceCapabilities</key>
<array>
   <string>arm64</string>
</array>

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×