Need Assistance with xCode Project - Linker Errors and Version Compatibility with Apple External Purchase Link

Hello Apple Developer Community, I am currently working on an xCode project that uses Objective-C and I am trying to integrate Apple's external purchase link APIs available in iOS 15.4. To use these APIs, I need to utilize async and completion handlers which are available from iOS 13 onwards. The issue I'm facing is that the current minimum deployment version for my project is iOS 12. I would like to ensure my code compiles properly for the correct iOS versions and I am also using #if available; to ensure this. However, I am unsure of how to guarantee my code builds effectively with the deployment version being set to either iOS 12 or 13. I am currently facing the following linker errors:

ld: warning: Could not find or use auto-linked library 'swiftCompatibility56': library 'swiftCompatibility56' not found
ld: warning: Could not find or use auto-linked library 'swiftCompatibilityConcurrency': library 'swiftCompatibilityConcurrency' not found
ld: warning: Could not find or use auto-linked library 'swiftCompatibilityPacks': library 'swiftCompatibilityPacks' not found
ld: Undefined symbols:
  __swift_FORCE_LOAD_$_swiftCompatibility51, referenced from:
      __swift_FORCE_LOAD_$_swiftCompatibility51_$_ProjectXYZ in ProjectXYZ.a[20](ExternalPurchaseLinkWrapper.o)
  __swift_FORCE_LOAD_$_swiftCompatibility56, referenced from:
      __swift_FORCE_LOAD_$_swiftCompatibility56_$_ProjectXYZ in ProjectXYZ.a[20](ExternalPurchaseLinkWrapper.o)
  __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency, referenced from:
      __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_ProjectXYZ in ProjectXYZ.a[20](ExternalPurchaseLinkWrapper.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I would appreciate any guidance or advice on this matter. How do I ensure my code compiles and works only for the correct versions and how do I resolve the linker errors? Thank you in advance for your assistance. Best, Sumanth

Let me see if I understand this correctly:

  1. You have a mostly Objective-C project.

  2. Its deployment target is set to iOS 12.

  3. You want to use Swift concurrency in that project in order to call iOS APIs that are built using that feature.

  4. Those APIs was introduced in iOS 15.4.

Is that right?

If so:

  • What version of Xcode are you using?

  • Have you tried boiling this down to a minimal test project? For example, if you create a small test project that gets the canOpen property, does it reproduce your link-time problem?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Need Assistance with xCode Project - Linker Errors and Version Compatibility with Apple External Purchase Link
 
 
Q