React-native-onesignal: Notification Service Extension Setup (without Cocoapods) results in Undefined symbols for architecture

Created on 7 Mar 2019  路  1Comment  路  Source: OneSignal/react-native-onesignal

Description:
I've completed the React Native OneSignal setup guide, and getting an "Undefined Symbols for Architecture" error which looks like this:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_RCTConvert", referenced from:
      objc-class-ref in libRCTOneSignal.a(RCTOneSignalEventEmitter.o)
  "_OBJC_CLASS_$_RCTEventEmitter", referenced from:
      _OBJC_CLASS_$_RCTOneSignalEventEmitter in libRCTOneSignal.a(RCTOneSignalEventEmitter.o)
  "_OBJC_METACLASS_$_RCTEventEmitter", referenced from:
      _OBJC_METACLASS_$_RCTOneSignalEventEmitter in libRCTOneSignal.a(RCTOneSignalEventEmitter.o)
  "_RCTRegisterModule", referenced from:
      +[RCTOneSignalEventEmitter load] in libRCTOneSignal.a(RCTOneSignalEventEmitter.o)
  "_RCTRunningInAppExtension", referenced from:
      -[RCTOneSignalEventEmitter checkPermissions:] in libRCTOneSignal.a(RCTOneSignalEventEmitter.o)
      -[RCTOneSignalEventEmitter requestPermissions:] in libRCTOneSignal.a(RCTOneSignalEventEmitter.o)
      -[RCTOneSignalEventEmitter getPermissionSubscriptionState:] in libRCTOneSignal.a(RCTOneSignalEventEmitter.o)
  "_RCTSharedApplication", referenced from:
      -[RCTOneSignalEventEmitter checkPermissions:] in libRCTOneSignal.a(RCTOneSignalEventEmitter.o)
      -[RCTOneSignalEventEmitter requestPermissions:] in libRCTOneSignal.a(RCTOneSignalEventEmitter.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Notes about my setup:

  • Setup without Cocoapods using react-native link
  • Used yarn for installation
  • React Native Version: 0.57.7
  • Notification Service Extension written in Obj-C

The library works completely fine without the notification service extension, so it doesn't seem like it's a problem with the react-native link step. It also has no problems until the compilation stage, meaning the header search paths are working correctly. I've added the three libraries as instructed to the Notification Service Extension target. Would love some help here!

Environment

  1. react-native: 0.57.7
  2. react-native-onesignal: 3.2.12

Let me know if I can provide any more info!

High Priority Help Wanted iOS

Most helpful comment

It's funny how once you write something out you start to understand it... In trying to replicate the bug with a fresh react-native init MyAwesomeProject I noticed some differences between that project and my own...

In creating a new Target, many build settings from my main app's target were carried over unknowingly. Once of those being the -Objc flag, which after removing from my Notification Service Extension Target's build settings, fixed the issue. Hope someone learns something from this!

>All comments

It's funny how once you write something out you start to understand it... In trying to replicate the bug with a fresh react-native init MyAwesomeProject I noticed some differences between that project and my own...

In creating a new Target, many build settings from my main app's target were carried over unknowingly. Once of those being the -Objc flag, which after removing from my Notification Service Extension Target's build settings, fixed the issue. Hope someone learns something from this!

Was this page helpful?
0 / 5 - 0 ratings