Detached iOS build fails with FBNativeAd error

When building our detached app after running exp detach, Xcode fails with a build error while compiling the ExpoKit pod with this error:

Property ‘title’ not found on object of type ‘FBNativeAd *’

The error occurs in:
ios/Pods/ExpoKit/ios/Exponent/Versioned/Core/Api/FBAds/EXNativeAdView.m

This is where the error is thrown:

{
  _nativeAd = nativeAd;

  _onAdLoaded(@{
    @"title": _nativeAd.title,
    @"subtitle": _nativeAd.subtitle,
    @"description": _nativeAd.body,
    @"socialContext": _nativeAd.socialContext,
    @"callToActionText": _nativeAd.callToAction,
    @"coverImage": _nativeAd.coverImage ? [_nativeAd.coverImage.url absoluteString] : [NSNull null],
    @"icon": _nativeAd.icon ? [_nativeAd.icon.url absoluteString] : [NSNull null],
  });

  [_nativeAd registerViewForInteraction:self withViewController:RCTKeyWindow().rootViewController];
}

The error persisted after reinstalling pods, re building, clearing out and re installing our node modules, and even un detaching and detaching the app again. I’ve also tried some different versions of ExpoKit with the same results.

Our SDK is version “27.0.0”
Our ExpoKit is version “ios/2.5.10”

Our app was running fine before we detached. We need to detach in order to add some video dependencies outside the support of the SDK.

Any help would be appreciated! Thanks

Getting the same issue after detaching with the latest SDK 28.

cc @ben

Just wanted to follow up here as well. Getting the same issue on both SDK 25 (2.3.3 release) and SDK 26 (2.4.3 release). Was working in our build pipeline yesterday so it most likely has to do with re-installing Pods. Locally I was able to get it to build by changing the file mentioned above to:

 _onAdLoaded(@{
    @"callToActionText": _nativeAd.callToAction,
    @"icon": _nativeAd.icon ? [_nativeAd.icon.url absoluteString] : [NSNull null],
  });
}

as well as having to change this block of code

RCT_ENUM_CONVERTER(FBNativeAdsCachePolicy, (@{
  @"none": @(FBNativeAdsCachePolicyNone),
  @"icon": @(FBNativeAdsCachePolicyIcon),
  @"image": @(FBNativeAdsCachePolicyCoverImage),
  @"all": @(FBNativeAdsCachePolicyAll),
}), FBNativeAdsCachePolicyNone, integerValue)

into

RCT_ENUM_CONVERTER(FBNativeAdsCachePolicy, (@{
  @"none": @(FBNativeAdsCachePolicyNone),
  @"icon": @(FBNativeAdsCachePolicyNone),
  @"image": @(FBNativeAdsCachePolicyNone),
  @"all": @(FBNativeAdsCachePolicyAll),
}), FBNativeAdsCachePolicyNone, integerValue)
2 Likes

Thank you, @daadler6, your changes got my build to run locally (though I also had to remove the @icon line).

Also getting the same issue after detaching to ExpoKit 26. Tried upgrading to ExpoKit 27 to solve the issue, but still got the same error.

Installing FBAudienceNetwork 4.28.1 (was 4.99.0) the upgrade to 4.99.0 from 4.28.1 was the source of the error. To avoid writing native code I suggest finding an old branch with a working Pod.lock file and then simply running a pod install.

1 Like

Sounds like the issue is from a breaking change in FBAudienceNetwork and not related to the Expo SDK release. I can look into it today.

1 Like

I’m running in two issues on this file:

  • the one from the main topic which is easely fix. My question is: is it a stable fix?
  • The second one is about this line :
  [_nativeAd registerViewForInteraction:self withViewController:RCTKeyWindow().rootViewController];

xCode tells me “‘No visible@interface for’FBNativeAd’ declares the selector 'registerViewFor Interaction:with ViewController:”

I’ve just started to install the Facebook SDK for analitycs etc…

Hey all, it looks like FBAudienceNetwork 4.28.1 (from April 9) contained the nativeAd.title property, but they mysteriously released 4.99.0 less than a day ago, which contains a ton of breaking changes (including removing the title property). So Expo’s ads module broke.

Tracking the issue here.

Downgrading FBAudienceNetwork did the trick for us, thanks! This error is solved on my end.

1 Like

Hi all, I’ve added a new ExpoKit version which pins the FBAudienceNetwork library to a not-broken version. Please follow the steps here if you are stuck.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.