React-native-permissions: iOS Release build: Undefined symbols for architecture arm64: "_OBJC_CLASS_$_RNPermissionHandlerLocationWhenInUse", referenced from: objc-class-ref in libRNPermissions.a(RNPermissions.o) ld: symbol(s) not found for architecture arm64

Created on 4 May 2021  Â·  4Comments  Â·  Source: zoontek/react-native-permissions

Bug report

Summary

I am able to compile and run in debug mode but getting the following error while running in release mode.

** ARCHIVE FAILED **

The following build commands failed:

    Ld .../_appcircle_temp/appcircle_export_archive/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/arm64/Binary/MyApp normal arm64

(1 failure)

Undefined symbols for architecture arm64:

  "_OBJC_CLASS_$_RNPermissionHandlerLocationWhenInUse", referenced from:

      objc-class-ref in libRNPermissions.a(RNPermissions.o)

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

@@[error] 5/4/2021 7:14:54 AM EXCEPTION

@@[error] @@[error] Process exit with error code: 1

@@[error] nb5tax4g.m3w Error at step: Xcodebuild for Devices

@@[error] EXCEPTION: @@[error] Process exit with error code: 1 

Environment info

System:
    OS: macOS 10.15.7
    CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
    Memory: 22.48 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.13.0 - /usr/local/bin/node
    Yarn: Not Found
    npm: 6.14.8 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.1, 30.0.2
      System Images: android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6858069
    Xcode: 12.3/12C33 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_272 - /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home//bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: ^17.0.1 => 17.0.1 
    react-native: ^0.64.0 => 0.64.0 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found ```

Library version: "react-native-permissions": "^3.0.1"

Reproducible sample code

Attached my podfile
target 'ShopDrop' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"

  target 'ShopDropTests' do
    inherit! :complete
    # Pods for testing
    pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
  end

Most helpful comment

That's potentially a bad idea though, it's a really useful cleaner but so very very expensive to rebuild after. I only did it as part of my release build process

All 4 comments

I suspect this cannot be reproduced with the sample app, especially not after npx react-native-clean-project
I have this specific LocationWhenInUse in use locally and it works fine (it worked fine with Xcode 12.3 as well IIRC, definitely with Xcode 12.4 and now with Xcode 12.5)

Thanks @mikehardy. npx react-native-clean-project really worked for me. Is there any way to add this step which runs automatically when we generate build by running "react-native run-ios"

@durgapt You can edit your package.json with a custom npm script: run-ios: npx react-native-clean-project && react-native run-ios

That's potentially a bad idea though, it's a really useful cleaner but so very very expensive to rebuild after. I only did it as part of my release build process

Was this page helpful?
0 / 5 - 0 ratings

Related issues

haveamission picture haveamission  Â·  19Comments

rohitgoyal picture rohitgoyal  Â·  20Comments

smokinjoe picture smokinjoe  Â·  19Comments

al-shivani picture al-shivani  Â·  25Comments

jessiealbarian picture jessiealbarian  Â·  43Comments