Chris Pim 34 Posted February 20, 2020 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
Dave Nottage 557 Posted February 21, 2020 (edited) Same happens for me. My guess is a bug in ld, since lipo reports that it has arm64. Reported the issue here: https://quality.embarcadero.com/browse/RSP-27697 Edited February 21, 2020 by Dave Nottage Share this post Link to post
Chris Pim 34 Posted February 21, 2020 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
eg1 0 Posted December 3, 2020 (edited) any update? I stuck here too. same problem: https://github.com/Gamua/Adobe-Runtime-Support/issues/261 https://developers.facebook.com/support/bugs/2382427331879496/ Also jvesoft have Admob and Facebook Audience component but I don't understand how he is added this framework successfully https://www.jvesoft.com/wp/configuring-ios/ Edited December 3, 2020 by eg1 Share this post Link to post
Dave Nottage 557 Posted December 4, 2020 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! 🙂 1 Share this post Link to post
Rollo62 536 Posted December 4, 2020 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. 1 Share this post Link to post
Chris Pim 34 Posted December 4, 2020 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
Chris Pim 34 Posted December 4, 2020 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. 3 Share this post Link to post
Dave Nottage 557 Posted December 4, 2020 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? 1 Share this post Link to post
Chris Pim 34 Posted December 4, 2020 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. 1 Share this post Link to post
eg1 0 Posted December 8, 2020 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
Dave Nottage 557 Posted December 8, 2020 7 hours ago, eg1 said: I tried to sign and deploy adapter sdk but deployment failed What were the errors? 1 Share this post Link to post
eg1 0 Posted December 9, 2020 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) 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
Dave Nottage 557 Posted December 9, 2020 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
eg1 0 Posted December 9, 2020 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
Rollo62 536 Posted December 9, 2020 Maybe that helps, suggest something with hardware ? https://becomethesolution.com/blogs/iphone/install-incompatible-ios-apps Share this post Link to post
eg1 0 Posted December 9, 2020 23 minutes ago, Rollo62 said: Maybe that helps, suggest something with hardware ? https://becomethesolution.com/blogs/iphone/install-incompatible-ios-apps 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