jpush / jpush/jpush-react-native

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

Open
#469 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.4k
Forks
348
PR merge metrics
No merged PRs in 30d

Description

你的运行环境

Xcode 9.2

  • 插件版本:
    "jcore-react-native": "^1.2.5",
    "jpush-react-native": "^2.1.12",

  • react-native 版本:
    "react-native": "0.50.3",

期望效果

实现jpush-react-native消息推送功能

实际效果

Xcode 编译报错:
Undefined symbols for architecture x86_64:
"_kJPFNetworkIsConnectingNotification", referenced from:
-[RCTJPushModule init] in RCTJPushModule.o
"_kJPFNetworkDidRegisterNotification", referenced from:
-[RCTJPushModule init] in RCTJPushModule.o
"_JCOREDisplayVersion", referenced from:
+[JPUSHService commonSetupWithOption:appKey:channel:apsForProduction:advertisingIdentifier:] in libjpush-ios-3.0.7.a(JPUSHService.o)
"_JCOREGetBuildVersion", referenced from:
+[JPUSHService commonSetupWithOption:appKey:channel:apsForProduction:advertisingIdentifier:] in libjpush-ios-3.0.7.a(JPUSHService.o)
"_kJPFNetworkDidSetupNotification", referenced from:
-[RCTJPushModule init] in RCTJPushModule.o
"_kJPFNetworkDidCloseNotification", referenced from:
-[RCTJPushModule init] in RCTJPushModule.o
-[RCTJPushModule reactJSDidload] in RCTJPushModule.o
"_kJPFNetworkDidLoginNotification", referenced from:
-[RCTJPushModule init] in RCTJPushModule.o
-[RCTJPushModule reactJSDidload] in RCTJPushModule.o
"_kJPFNetworkDidReceiveMessageNotification", referenced from:
-[RCTJPushModule init] in RCTJPushModule.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

重现步骤

  1. 在项目根目录执行 yarn add jpush-react-native jcore-react-native 安装插件
  2. 在项目根目录执行 react-native link 安装依赖 执行中并输入key值已完成自配置
  3. 在ios项目跟目录执行 pod install 集成插件
    4.打开Xcode的Build Settings的Search Paths的Header Search Paths添加路径:$(SRCROOT)/../node_modules/jpush-react-native/ios/RCTJPushModule
    5.打开Xcode的Build Phases的Link Binary With Libraries添加如下库:
    libz.tbd
    CoreTelephony.framework
    Security.framework
    CFNetwork.framework
    CoreFoundation.framework
    SystemConfiguration.framework
    Foundation.framework
    UIKit.framework
    UserNotifications.framework
    libresolv.tbd
    6.把UserNotifications.framework的Status改为Optional
    7.把Capabilities的Push Notifiactions 值改为ON,并Steps都为√
    8.把node_modules>jpush-react-native>ios>RCTPushModule.xcodeproj添加到Xcode项目的Libraries文件夹中
    9.把node_modules>jpush-react-native>ios>RCTPushModule整个文件夹添加到Xcode项目的项目根目录下

Debug logs

ios Xcode编译报错:
Ld /Users/samcms/Library/Developer/Xcode/DerivedData/nnapp-dkdeqhvvcosmxqfxmtrdqiugfrvn/Build/Products/Debug-iphonesimulator/JPushRN/JPushRN.framework/JPushRN normal x86_64
cd /Users/samcms/Desktop/nnapp/ios/Pods
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.2.sdk -L/Users/samcms/Library/Developer/Xcode/DerivedData/nnapp-dkdeqhvvcosmxqfxmtrdqiugfrvn/Build/Products/Debug-iphonesimulator/JPushRN -L/Users/samcms/Desktop/nnapp/ios/Pods/../../node_modules/jpush-react-native/ios/RCTJPushModule -F/Users/samcms/Library/Developer/Xcode/DerivedData/nnapp-dkdeqhvvcosmxqfxmtrdqiugfrvn/Build/Products/Debug-iphonesimulator/JPushRN -F/Users/samcms/Library/Developer/Xcode/DerivedData/nnapp-dkdeqhvvcosmxqfxmtrdqiugfrvn/Build/Products/Debug-iphonesimulator/React -filelist /Users/samcms/Library/Developer/Xcode/DerivedData/nnapp-dkdeqhvvcosmxqfxmtrdqiugfrvn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/JPushRN.build/Objects-normal/x86_64/JPushRN.LinkFileList -install_name @rpath/JPushRN.framework/JPushRN -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -mios-simulator-version-min=8.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/samcms/Library/Developer/Xcode/DerivedData/nnapp-dkdeqhvvcosmxqfxmtrdqiugfrvn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/JPushRN.build/Objects-normal/x86_64/JPushRN_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -ljpush-ios-3.0.7 -lresolv -lz -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreTelephony -framework Foundation -framework Security -framework SystemConfiguration -framework UIKit -weak_framework UserNotifications -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreTelephony -framework Foundation -framework React -framework Security -framework SystemConfiguration -framework UIKit -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/samcms/Library/Developer/Xcode/DerivedData/nnapp-dkdeqhvvcosmxqfxmtrdqiugfrvn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/JPushRN.build/Objects-normal/x86_64/JPushRN_dependency_info.dat -o /Users/samcms/Library/Developer/Xcode/DerivedData/nnapp-dkdeqhvvcosmxqfxmtrdqiugfrvn/Build/Products/Debug-iphonesimulator/JPushRN/JPushRN.framework/JPushRN

Undefined symbols for architecture x86_64:
"_kJPFNetworkIsConnectingNotification", referenced from:
-[RCTJPushModule init] in RCTJPushModule.o
"_kJPFNetworkDidRegisterNotification", referenced from:
-[RCTJPushModule init] in RCTJPushModule.o
"_JCOREDisplayVersion", referenced from:
+[JPUSHService commonSetupWithOption:appKey:channel:apsForProduction:advertisingIdentifier:] in libjpush-ios-3.0.7.a(JPUSHService.o)
"_JCOREGetBuildVersion", referenced from:
+[JPUSHService commonSetupWithOption:appKey:channel:apsForProduction:advertisingIdentifier:] in libjpush-ios-3.0.7.a(JPUSHService.o)
"_kJPFNetworkDidSetupNotification", referenced from:
-[RCTJPushModule init] in RCTJPushModule.o
"_kJPFNetworkDidCloseNotification", referenced from:
-[RCTJPushModule init] in RCTJPushModule.o
-[RCTJPushModule reactJSDidload] in RCTJPushModule.o
"_kJPFNetworkDidLoginNotification", referenced from:
-[RCTJPushModule init] in RCTJPushModule.o
-[RCTJPushModule reactJSDidload] in RCTJPushModule.o
"_kJPFNetworkDidReceiveMessageNotification", referenced from:
-[RCTJPushModule init] in RCTJPushModule.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the iOS integration steps and the build command shown in the report, then inspect node_modules/jpush-react-native/ios/RCTJPushModule and the linked libjpush-ios-3.0.7.a. Check how the build provides the missing JCORE and network notification symbols, and rerun the simulator build after pod install. Done means the JPushRN framework links successfully without undefined-symbol errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native
Domain
build-system, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.