AdaptySDK-React-Native: Can not Archive iOS project

Project with react-native-adapty integration can not be Archived to release and upload to the App Store.

I tested also with example app from this repo - the same result.

react-native-adapty=1.3.10

Build works, I can run it on the real device, but when trying to Archive in Xcode - getting the error:

Undefined symbols for architecture arm64:
  "_swift_stdlib_isStackAllocationSafe", referenced from:
      function signature specialization <Arg[1] = Owned To Guaranteed> of generic specialization <[Swift.String : Swift.String], [[Swift.String : Swift.String]]> of Swift._NativeSet.subtracting<A where A == A1.Element, A1: Swift.Sequence>(A1) -> Swift._NativeSet<A> in libAdapty.a(KinesisManager.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It fails on the Linking stage

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18

Commits related to this issue

Most upvoted comments

Fixes found

@akolpakov

Problem is occurring after updating Xcode 13.3. I’ve tested these fixes on Adapty example, you can use any of listed:

1. Updating Library Search Paths in Xcode

You need to change Library Search Paths in Xcode:

  • Remove "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"
  • Add "$(SDKROOT)/usr/lib/swift"

Should work after that

Screenshot 2022-04-03 at 10 20 26

2. Adding new fix_library_search_paths feature in your Podfile

In your podfile find post_install section and add one line of fix_library_search_paths(installer) there and function itself. Should work after that.

    ...
     post_install do |installer|
         flipper_post_install(installer)
+       fix_library_search_paths(installer)
     end
 end


+def fix_library_search_paths(installer)
+  def fix_config(config)
+    lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
+    if lib_search_paths
+      if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
+        # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
+        # since the libraries there are only built for x86_64 and i386.
+        lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
+        lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
+        if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
+          # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
+          lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
+        end
+      end
+    end
+  end
+
+  projects = installer.aggregate_targets
+    .map{ |t| t.user_project }
+    .uniq{ |p| p.path }
+    .push(installer.pods_project)
+
+  projects.each do |project|
+    project.build_configurations.each do |config|
+      fix_config(config)
+    end
+    project.native_targets.each do |target|
+      target.build_configurations.each do |config|
+        fix_config(config)
+      end
+    end
+    project.save()
+  end
+end

Also, it is said, that updating RN to >= 0.67 helps, although I've failed to make this work with Adapty example

All of these fixes were found in this react-native-purchases issue. Huge props to them! If you are willing to find more info about this bug nature, it is also available there.

@akolpakov workaround found One of our users also faced this issue and has found a problem. They downgraded Xcode from 13.3 to 13.2 and everything worked.