Appboy / appboy-ios-sdk

Public repo for the Braze iOS SDK
https://www.braze.com
Other
165 stars 142 forks source link

3.27.0 doesn't link in Xcode 12 #250

Closed pmacro closed 3 years ago

pmacro commented 3 years ago

Report

Describe your environment.

Info Value
Platform Name ios
Platform Version 14.0
SDK Version 3.4.0
Integration Method cocoapods
Xcode Version Xcode 12.0
Repro rate 100%

What did you do?

Updated to the latest release versions of AppBoy and AppBoy-Segment

What did you expect to happen?

My project would build successfully.

What happened instead?

ld: warning: ignoring file /Users/paulm/Library/Developer/Xcode/DerivedData/Project-btwaivghyxbpichgjeamfasfbxnu/Build/Products/Debug-iphonesimulator/Appboy-iOS-SDK/Appboy_iOS_SDK.framework/Appboy_iOS_SDK, building for iOS Simulator-arm64 but attempting to link with file built for iOS Simulator-x86_64
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_ABKAttributionData", referenced from:
      objc-class-ref in SEGAppboyIntegration.o
  "_ABKSDKFlavorKey", referenced from:
      -[SEGAppboyIntegration initWithSettings:appboyOptions:] in SEGAppboyIntegration.o
  "_ABKEndpointKey", referenced from:
      -[SEGAppboyIntegration initWithSettings:appboyOptions:] in SEGAppboyIntegration.o
  "_OBJC_CLASS_$_Appboy", referenced from:
      objc-class-ref in SEGAppboyHelper.o
      objc-class-ref in SEGAppboyIntegration.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Steps to reproduce

More

Please note that I was successfully using the betas of these libraries and switching back and forth between the betas and the new releases will fix/break the build, respectively.

To be clear, this works:

    pod 'Segment-Appboy', '3.4.0-beta1'
    pod 'Appboy-iOS-SDK', '3.27.0-beta2'

While this does not:

    pod 'Appboy-iOS-SDK', '3.27.0'
    pod 'Segment-Appboy', '3.4.0'

I made sure to clean the project, derived data etc.

Note the iOS Simulator-arm64 in the error. I'm unsure if that's Apple Silicon, but if so, just want to call out that I'm on x86_64 and am not on an Apple Silicon dev kit.

chshapiro commented 3 years ago

Hey @pmacro,

Can you provide some more information as we are unable to reproduce? Are you getting the error when building to a simulator, device, or both? Additionally, is the Build Configuration in your scheme set to Debug, Develop, or Release?

In the meantime, the code in 3.27.0 is basically identical to 3.27.0-beta3 and you can continue using the beta version until we solve this issue.

Thanks!

pmacro commented 3 years ago

Hi @chshapiro. I'm building for the simulator, in Debug mode. Building for a device works fine.

Happy to provide any further information, or help debug.

Thanks!

pmacro commented 3 years ago

@chshapiro I don't know if this is helpful, but it looks like the inconsistent setting of Excluded Architectures for Appboy and Segment-Appboy is what's causing the issue. Adding arm64 to the simulator setting for Excluded Architectures in Segment-Appboy fixes this. And I double checked the beta of Segment-Appboy, and it had that setting, but it is not present in the release.

chshapiro commented 3 years ago

@pmacro, Thank you for that additional information! We are preparing a fix and will have it released this week.

pmacro commented 3 years ago

@chshapiro thanks for the help and quick turnaround

chshapiro commented 3 years ago

Hey @pmacro,

We just released version 3.4.1 of the Segment SDK. Can you test it out and let us know if it fixes the issue for you?

Thanks!

pmacro commented 3 years ago

Thank you, @chshapiro! This appears to have resolved the issue.

romandrahan commented 3 years ago

@chshapiro, we're still experiencing similar issue while building the project with Xcode 12:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_SDImageCache", referenced from:
      objc-class-ref in ABKSDWebImageProxy.o
  "_OBJC_CLASS_$_SDWebImageManager", referenced from:
      objc-class-ref in ABKSDWebImageProxy.o
  "_OBJC_CLASS_$_SDWebImageActivityIndicator", referenced from:
      objc-class-ref in ABKSDWebImageProxy.o
  "_OBJC_CLASS_$_SDWebImagePrefetcher", referenced from:
      objc-class-ref in ABKContentCardsTableViewController.o
      objc-class-ref in ABKNewsFeedTableViewController.o
      objc-class-ref in ABKSDWebImageProxy.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It fails just the same as was for @pmacro: fine while building for device, fails while building for simulator.

From: https://github.com/NativeScript/nativescript-cli/issues/5411

Bucimis commented 3 years ago

@romandragan which version of SDWebImage are you using? You'll need 5.8.2 or above to build with 3.27.0

romandrahan commented 3 years ago

@Bucimis, it's the very latest one: 5.9.3, and we're using the latest Appboy-iOS-SDK 3.29.0.

romandrahan commented 3 years ago

BTW. Is there any way not to include Content Cards (and SDWebImage) Pods as we're not using them? This could be (dirty) but possible workaround.

Bucimis commented 3 years ago

@romandragan Are you using in-app messages? SDWebImage is required/used for them (if using Braze out of the box UIs)

romandrahan commented 3 years ago

@Bucimis, yes we are.

Bucimis commented 3 years ago

@romandragan and are you using the AppBoy-Segment pod like the OP or Appboy-iOS-SDK

romandrahan commented 3 years ago

@Bucimis, we're using just Appboy-iOS-SDK Pod, version 3.29.0.

romandrahan commented 3 years ago

@Bucimis, @chshapiro, any progress on this guys?

Bucimis commented 3 years ago

@romandragan could you take a look at the EXCLUDED_ARCHS build setting of your generated XCode project and drop the results here? Both NativeScript and our SDK make edits to the field and it's possible they're conflicting.

romandrahan commented 3 years ago

@Bucimis, trying to give most complete answer :)

Found in generated build.xcconfig:

EXCLUDED_ARCHS_x86_64 = arm64 arm64e
EXCLUDED_ARCHS[sdk=iphonesimulator*] = i386 armv6 armv7 armv7s armv8 $(EXCLUDED_ARCHS_$(NATIVE_ARCH_64_BIT))
EXCLUDED_ARCHS[sdk=iphoneos*] = i386 armv6 armv7 armv7s armv8 x86_64

Found in generated Podfile:

installer.pods_project.build_configurations.each do |config|
    config.build_settings.delete "VALID_ARCHS"
    config.build_settings["EXCLUDED_ARCHS_x86_64"] = "arm64 arm64e"
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "i386 armv6 armv7 armv7s armv8 $(EXCLUDED_ARCHS_$(NATIVE_ARCH_64_BIT))"
    config.build_settings["EXCLUDED_ARCHS[sdk=iphoneos*]"] = "i386 armv6 armv7 armv7s armv8 x86_64"
end

Screens from Xcode itself 👇

Project build settings:

image

Pod build settings:

image
romandrahan commented 3 years ago

@Bucimis, with new IDFA collection implemented we now have another issue that can be related to current one:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_ATTrackingManager", referenced from:
      objc-class-ref in IDFADelegate.o
ld: symbol(s) not found for architecture x86_64

So it fails here:

#import "IDFADelegate.h"
#import <AdSupport/ASIdentifierManager.h>
#import <AppTrackingTransparency/AppTrackingTransparency.h>

@implementation IDFADelegate

- (NSString *)advertisingIdentifierString {
  return [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
}

- (BOOL)isAdvertisingTrackingEnabledOrATTAuthorized {
  // TODO commenting out this line solves the problem but breaks iOS 14 IDFA collection
  if (@available(iOS 14, *)) {
    return [ATTrackingManager trackingAuthorizationStatus] == ATTrackingManagerAuthorizationStatusAuthorized;
  }

  return [[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled];
}

@end
tbelote commented 3 years ago

@romandragan I believe you need to add the AppTrackingTransparency framework to link to your app.

romandrahan commented 3 years ago

@tbelote, isn't it supposed to be added automatically?

tbelote commented 3 years ago

@romandragan No it's not, you have to add it to your target in the build phases tab like this (of course there will be other frameworks too). Another option for now is you can remove the ATTManager code from the IDFA delegate, but when apple starts enforcing AppTrackingTransparency the IDFA will always be 0 in that case.

Screen Shot 2020-10-23 at 10 34 00 AM