floatinghotpot / cordova-plugin-facebookads

Cordova/PhoneGap plugin for Facebook Audience Network Ads
64 stars 71 forks source link

Error building IOS (just started recently) #78

Open ghost opened 6 years ago

ghost commented 6 years ago

Plugin used to build fine with PhoneGap Build. Then, recently - in the last few days, we started getting failed builds for IOS.

Any ideas?

Here is the bottom output of the logs:


FBAudienceNetwork(FNFMp4StreamingParser.mm.o)
      std::__1::__split_buffer<FNFMP4TimeToSampleTableEntry, std::__1::allocator<FNFMP4TimeToSampleTableEntry>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<FNFMP4TimeToSampleTableEntry>&) in FBAudienceNetwork(FNFMp4StreamingParser.mm.o)
      std::__1::__split_buffer<FNFMP4SampleToChunkTableEntry, std::__1::allocator<FNFMP4SampleToChunkTableEntry>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<FNFMP4SampleToChunkTableEntry>&) in FBAudienceNetwork(FNFMp4StreamingParser.mm.o)
      ...
  "_xmlXPathCastToNumber", referenced from:
      +[FNFMediaPresentationDescription presentationDescriptionWithContentsOfXml:mpdUrl:segmentsFromEndToStartForLive:vp9Enabled:opusEnabled:error:] in FBAudienceNetwork(FNFMediaPresentationDescription.mm.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** ARCHIVE FAILED **

The following build commands failed:
    Ld /Users/phonegap/Library/Developer/Xcode/DerivedData/BisManOnline-gqhteeqfdxgkkydchtcsuigqakve/Build/Intermediates/ArchiveIntermediates/BisManOnline/IntermediateBuildFilesPath/BisManOnline.build/Release-iphoneos/BisManOnline.build/Objects-normal/arm64/BisManOnline normal arm64
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/private/tmp/gimlet/1783218/project/cordova/build-release.xcconfig,-workspace,BisManOnline.xcworkspace,-scheme,BisManOnline,-configuration,Release,-destination,generic/platform=iOS,-archivePath,BisManOnline.xcarchive,archive,CONFIGURATION_BUILD_DIR=/private/tmp/gimlet/1783218/project/build/device,SHARED_PRECOMPS_DIR=/private/tmp/gimlet/1783218/project/build/sharedpch
BigFoppa commented 6 years ago

I had the same error building from Visual Studio after updating the plugins for admob with facebook mediation. When building with xcode the error was a bit more explicit. FBKVOController that is referenced from FBAudienceNetwork is not found.

The error is actually in the plugin cordova-plugin-audnet-sdk that facebookads depends on. The master for audnet-sdk here on github have the KVOController.framework so I installed the plugins from there: cordova plugin add https://github.com/floatinghotpot/cordova-plugin-audnet-sdk.git cordova plugin add https://github.com/floatinghotpot/cordova-plugin-facebookads.git

The build succeeded BUT the app crashes when started. Ok so building and deploying to device in xcode gives the error that the framework could not be loaded. After som googling I found that if you in xcode under General add KVOController.framework to Embedded Binaries then it works properly. But that is not an option for me as I want to build from VS.

More googling and I found the source for KVOController here https://github.com/facebook/KVOController/tree/master/FBKVOController I have never built a plugin but looking at other plugins with source code I mimicked what they were doing.

  1. Downloaded cordova-plugin-audnet-sdk from github.
  2. Removed the KVOController.framework directory.
  3. Placed the source for KVOController in subdir src/ios/.
  4. Replaced the reference to KVOController in the ios section in plugin.xml to look like this:
    <config-file target="config.xml" parent="/*">
        <feature name="KVOController">
            <param name="ios-package" value="KVOController"/>
        </feature>
    </config-file>

    <header-file src="src/ios/KVOController.h" />
    <header-file src="src/ios/FBKVOController.h" />
    <source-file src="src/ios/FBKVOController.m" />
    <header-file src="src/ios/NSObject+FBKVOController.h" />
    <source-file src="src/ios/NSObject+FBKVOController.m" />

    <!-- framework src="KVOController.framework" custom="true" / -->
  1. Removed (with --force) and reinstalled the plugin from my local directory.

And now it works. Hope this helps you until @floatinghotpot fixes this.

//Big

floatinghotpot commented 6 years ago

@BigFoppa amazing. you are just right. I found the same solution but not do it quick enough. Will update the plugin now.

floatinghotpot commented 6 years ago

Fixed and published as:

ghost commented 6 years ago

cordova-facebook-audnet-sdk@4.26.2

To be clear - We just add this in as a plugin above "cordova-plugin-facebookads"

BigFoppa commented 6 years ago

@floatinghotpot Thanks for your great work! Just tested to remove plugins and install "cordova-plugin-admob-facebook". It brings in the updated versions of the plugins and it works perfectly.

@ekubischta As the latest versions of the plugins are now published to npm you only need to remove the plugins and install the facebookads plugin. It will thru its dependency bring in the latest version of "cordova-facebook-audnet-sdk".

Nakea commented 6 years ago

@floatinghotpot I'm still getting the error for ios. I've installed cordova-facebook-audnet-sdk@4.26.2 and made sure the appropriate versions of the required plugins were installed. I also tried the fix that BigFoppa suggested installing from the repositories. (However, I didn't see 'KVOController.framework' available to embed).

Any other ideas on what I could try?

BigFoppa commented 6 years ago

@Nakea forget about my workaround, you don't need that anymore. The plugin is fixed for this now. Are you sure its the same error? The KVOController.framework file is no longer needed. Remove the plugins you got installed and only install the cordova-plugin-facebookads. Or if you like me use admobpro with mediation then you install cordova-plugin-admob-facebook. /Big