launchdarkly / ios-client-sdk

LaunchDarkly Client-side SDK for iOS (Swift and Obj-C)
https://docs.launchdarkly.com/sdk/client-side/ios
Other
69 stars 84 forks source link

SwiftPM Results in Binary Rejection on Submission to Apple #216

Closed spr closed 4 years ago

spr commented 4 years ago

Is this a support request?

No

Describe the bug

If you use SwiftPM to add LaunchDarkly 5.0.1 to an application, and submit to the app store, it is rejected with

ITMS-90562: Invalid Bundle - One or more dynamic libraries that are referenced by your app are not present in the dylib search path.

According to https://developer.apple.com/library/archive/technotes/tn2435/_index.html#//apple_ref/doc/uid/DTS40017543-CH1-TROUBLESHOOTING You can obtain the dynamic libraries the app is expecting via otool -L <AppName>.app/<AppBinary>. When run on a sample project the output includes:

@rpath/LDSwiftEventSource.framework/LDSwiftEventSource (compatibility version 0.0.0, current version 0.0.0)

However, SwiftPM dependencies use static linking. Consequently, the framework is not included in the resulting application.

To reproduce Steps to reproduce the behavior.

  1. Create new project
  2. Add LaunchDarkly as a dependency as per the README
  3. Build for Release
  4. Right click on the app in the Products Group, show in Finder. Right click, "Show Package Contents", in a terminal type otool -L and drag the binary onto the terminal, hit enter, observe the @rpath present.

Expected behavior No @rpath present in otool -L output.

Logs Full otool -L output for test project:

/Users/spr/Library/Developer/Xcode/DerivedData/Test_Prjection-gmbxeobrbnbmupazxgnudwaqjzfb/Build/Products/Release-iphoneos/Test Prjection.app/Test Prjection:
    @rpath/LDSwiftEventSource.framework/LDSwiftEventSource (compatibility version 0.0.0, current version 0.0.0)
    /System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 1677.104.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
    /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 1677.104.0)
    /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration (compatibility version 1.0.0, current version 1061.140.1)
    /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 61000.0.0)
    /usr/lib/swift/libswiftCore.dylib (compatibility version 1.0.0, current version 1103.2.25)
    /usr/lib/swift/libswiftDispatch.dylib (compatibility version 1.0.0, current version 0.0.0)
    /usr/lib/swift/libswiftFoundation.dylib (compatibility version 1.0.0, current version 0.0.0)
    /usr/lib/swift/libswiftObjectiveC.dylib (compatibility version 1.0.0, current version 0.0.0)

SDK version The version of this SDK that you are using. 5.0.1

Language version, developer tools Xcode 11.6

OS/platform macOS 10.15.5

Additional context Add any other context about the problem here.

gwhelanLD commented 4 years ago

Hi @spr,

Thanks for the issue report! We appreciate you giving the new major release a try, and letting us know about this app store submission rejection. We'll start looking into this right away to get a 5.1 release out to correct this issue.

Thanks, @gwhelanLD

gwhelanLD commented 4 years ago

Hi @spr,

We've just released 5.1.0 which should resolve this issue. Please give it a try and let us know if you run into any issues.

Thanks! @gwhelanLD

spr commented 4 years ago

The otool -L output looks good to me. I'm not actively using SwiftPM (it was a fallback because of the carthage issue), so not in a great place to validate the app store submission side.

gwhelanLD commented 4 years ago

Closing this for now, thanks for taking a look even though you didn't plan to use SwiftPM.

Thanks, @gwhelanLD