facebook / facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.
https://developers.facebook.com/docs/ios
Other
7.73k stars 3.5k forks source link

ld: symbol(s) not found for architecture arm64 (Flutter) #2382

Open antonengelhardt opened 1 month ago

antonengelhardt commented 1 month ago

Checklist before submitting a bug report

Xcode version

15.3

Facebook iOS SDK version

17.0.0

Dependency Manager

CocoaPods

SDK Framework

Other / I don't know

Goals

I want to push our Flutter app to the App Store

Expected results

The build process runs in our CI/CD with Github Actions and builds the app using Fastlane, before uploading it to Apple Store Connect.

Actual results

The process crashes (i can send more logs, but this is the important bit):

Warning:       __swift_FORCE_LOAD_$_swiftCompatibility56_$_FBAudienceNetwork in FBAudienceNetwork(FBAudienceNetwork.o)
Error: ld: symbol(s) not found for architecture arm64
Error: clang: error: linker command failed with exit code 1 (use -v to see invocation)
** ARCHIVE FAILED **

Seems related: https://developers.facebook.com/community/threads/2619622534990991/ https://stackoverflow.com/questions/53754230/ld-framework-not-found-fbaudiencenetwork

Steps to reproduce

We build with Fastlane on v2.216 and Cocoapods v1.15

Code samples & details

We use the following pubs:

dependencies:
  flutter:
    sdk: flutter
  # many hidden
  firebase_messaging: 14.7.2
  firebase_core: 2.22.0
  facebook_app_events: 0.19.2
  firebase_auth: ^4.14.0
  sign_in_button: ^3.2.0
  google_sign_in: ^6.2.1
  flutter_facebook_auth: 6.2.0
  sign_in_with_apple: ^5.0.0

and pods:

DEPENDENCIES:
// also some items hidden
  - facebook_app_events (from `.symlinks/plugins/facebook_app_events/ios`)
  - firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
  - firebase_core (from `.symlinks/plugins/firebase_core/ios`)
  - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
  - Flutter (from `Flutter`)
  - flutter_facebook_auth (from `.symlinks/plugins/flutter_facebook_auth/ios`)
  - FMDB
  - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`)
  - local_auth_ios (from `.symlinks/plugins/local_auth_ios/ios`)
  - sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`)

FBSDKCoreKit is on v17, FBAudienceNetwork on v6.15, FBAEMKit v17, facebook_app_events v0.0.1,
daltonbr commented 4 weeks ago

I had a similar error in Unity - perhaps it is the same root cause.

I managed to get the two symbols that were missing

Undefined symbol: _FBRewardedVideoAdBridgeOnServerRewardFailure
Undefined symbol: _FBRewardedVideoAdBridgeOnServerRewardSuccess
ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
ld: warning: Could not find or use auto-linked framework 'UnitySwiftProtobuf': framework 'UnitySwiftProtobuf' not found
Undefined symbols for architecture arm64:
  "_FBRewardedVideoAdBridgeOnServerRewardFailure", referenced from:
      _RewardedVideoAdBridgeIOS_FBRewardedVideoAdBridgeOnServerRewardFailure_m31803DFCCAA3EB40D0E35D9A58626508AC8736FD in libGameAssembly.a[27](vtaseqwcbsnk.o)
      _RewardedVideoAdBridgeIOS_Create_mB983DC16F649F7C1F4DA25945CB5F4FB3DB1888E in libGameAssembly.a[27](vtaseqwcbsnk.o)
  "_FBRewardedVideoAdBridgeOnServerRewardSuccess", referenced from:
      _RewardedVideoAdBridgeIOS_FBRewardedVideoAdBridgeOnServerRewardSuccess_m1D22BCF0E541A62E8415B1A71D2A077E999E28F8 in libGameAssembly.a[27](vtaseqwcbsnk.o)
      _RewardedVideoAdBridgeIOS_Create_mB983DC16F649F7C1F4DA25945CB5F4FB3DB1888E in libGameAssembly.a[27](vtaseqwcbsnk.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Xcode version 15.3

Facebook iOS SDK version 17.0.0 (The Unity version)

Dependency Manager 1.15.2 CocoaPods


A workaround to get rid of the compilation errors was to disable the AudienceNetwork code that relied on the missing symbols in RewardVideoAd.cs. Still, this isn't a good solution as this could cripple the functionality of the package.

// [DllImport("__Internal")]
// private static extern void FBRewardedVideoAdBridgeOnServerRewardSuccess(int uniqueId,
//         FBRewardedVideoAdBridgeExternalCallback callback);

// [DllImport("__Internal")]
// private static extern void FBRewardedVideoAdBridgeOnServerRewardFailure(int uniqueId,
//         FBRewardedVideoAdBridgeExternalCallback callback);
daltonbr commented 4 weeks ago

I've searched the source doe in FBAudienceNetwork 6.15.0 and indeed it doesn't contain those two symbols - which we had on version 6.14.0. You can download both versions on this page

/FBAudienceNetwork-6.15.0/Static/FBAudienceNetwork.xcframework/ios-arm64/FBAudienceNetwork.framework/Headers/FBRewardedVideoAdBridge.h

6.15.0

...

FB_EXPORT void FBRewardedVideoAdBridgeOnLoad(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXPORT void FBRewardedVideoAdBridgeOnImpression(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXPORT void FBRewardedVideoAdBridgeOnClick(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXPORT void FBRewardedVideoAdBridgeOnError(int32_t uniqueId, FBAdBridgeErrorCallback callback);
FB_EXPORT void FBRewardedVideoAdBridgeOnDidClose(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXPORT void FBRewardedVideoAdBridgeOnWillClose(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXPORT void FBRewardedVideoAdBridgeOnVideoComplete(int32_t uniqueId, FBAdBridgeCallback callback);

FB_EXTERN_C_END

6.14.0

FB_EXPORT void FBRewardedVideoAdBridgeOnServerRewardSuccess(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXPORT void FBRewardedVideoAdBridgeOnServerRewardFailure(int32_t uniqueId, FBAdBridgeCallback callback);
daltonbr commented 4 weeks ago

For context, in my case, the code requesting those missing symbols was the Unity version of the FAN - which is "stuck" in version 6.4.0 since 2021.

Most likely we will try to remove it and only use the iOS SDK (in my case through AppLovin).

antonengelhardt commented 3 weeks ago

@daltonbr Thanks for your help on this.

Im not sure, if this really helps me a lot, because we're using Flutter and i don't really have much control over the Pods (that flutter manages on its own) and even less control on the source code of the Pods.

I have removed the facebook_app_events pub for now and i'll wait until a new version comes out that eventually fixes this.

hellysmile commented 3 weeks ago

@antonengelhardt

I've manually edited ios/Podfile.lock like this

  - facebook_app_events (0.0.1):
    - FBAudienceNetwork (~> 6.12)
    - FBSDKCoreKit (~> 16.0)
    - Flutter
  - FBAudienceNetwork (6.12.0)

And removed FBAudienceNetwork from SPEC CHECKSUMS

To force bind FBAudienceNetwork to lower version

cd ios && pod install

and it works ;)