Skip to content

iOS: custom module crashes on react-native 0.49+  #17430

@af-fess

Description

@af-fess

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

OS: macOS High Sierra 10.13.1
Node: 7.2.1
Yarn: Not Found
npm: 4.6.1
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 2.2 AI-145.3537739

Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: 0.51.0 => 0.51.0

Steps to Reproduce

We try to integrate AppsFlyer module, it works great on react-native <= 0.48 but crashes on 0.49+ (in my example - latest 0.51.0)

  1. Create empty project with $ react-native init Demo_4_10

  2. $ cd Demo_4_10/

  3. Install AppsFlyer plugin by running $ npm install react-native-appsflyer --save

  4. run $ cd ios/

  5. $ pod init - it will create Podfile

  6. Add to Podfile following row: pod 'react-native-appsflyer',:path => '../node_modules/react-native-appsflyer' so it will look like:

     ```
     target 'Demo_4_10' do
     pod 'react-native-appsflyer',:path => '../node_modules/react-native-appsflyer
     end
     ```
    
  7. run $ pod install

    Output:

    	Analyzing dependencies
    	Fetching podspec for `react-native-appsflyer` from `../node_modules/react-native-appsflyer`
    	Downloading dependencies
    	Installing AppsFlyerFramework (4.8.1)
    	Installing React (0.11.0)
    	Installing react-native-appsflyer (1.1.9)
    	Generating Pods project
    	Integrating client project
    
  8. Open in Xcode new crested Demo_4_10.xcworkspace and run the project on Device.

Expected Behavior

The app should run without any error or crash. Keep in mind we even do not load AppsFlyer module in Javascript

Actual Behavior

The crash happens in react-native/ReactCommon/cxxreact/ModuleRegistry.cpp row 116:

std::vector<MethodDescriptor> methods = module->getMethods();

The app output is so far till crash happens:

2018-01-03 09:50:49.986 [info][tid:main][RCTCxxBridge.mm:213] Initializing <RCTCxxBridge: 0x17d29740> (parent: <RCTBridge: 0x17d400f0>, executor: (null))
2018-01-03 09:50:49.990338+0200 Demo_4_10[552:243335] Initializing <RCTCxxBridge: 0x17d29740> (parent: <RCTBridge: 0x17d400f0>, executor: (null))
2018-01-03 09:50:50.061 [warn][tid:main][RCTBridge.m:121] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?
2018-01-03 09:50:50.060873+0200 Demo_4_10[552:243335] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?
2018-01-03 09:50:50.197 [info][tid:main][RCTRootView.m:301] Running application Demo_4_10 ({
    initialProps =     {
    };
    rootTag = 1;
})
2018-01-03 09:50:50.197195+0200 Demo_4_10[552:243335] Running application Demo_4_10 ({
    initialProps =     {
    };
    rootTag = 1;
})
2018-01-03 09:50:52.485 [info][tid:main][RCTCxxBridge.mm:905] Invalidating <RCTCxxBridge: 0x17d29740> (parent: <RCTBridge: 0x17d400f0>, executor: RCTWebSocketExecutor)
2018-01-03 09:50:52.485292+0200 Demo_4_10[552:243335] Invalidating <RCTCxxBridge: 0x17d29740> (parent: <RCTBridge: 0x17d400f0>, executor: RCTWebSocketExecutor)
2018-01-03 09:50:52.487 [info][tid:main][RCTCxxBridge.mm:213] Initializing <RCTCxxBridge: 0x17e6bf10> (parent: <RCTBridge: 0x17d400f0>, executor: RCTWebSocketExecutor)
2018-01-03 09:50:52.487328+0200 Demo_4_10[552:243335] Initializing <RCTCxxBridge: 0x17e6bf10> (parent: <RCTBridge: 0x17d400f0>, executor: RCTWebSocketExecutor)

The crash print screen:

screen shot 2018-01-03 at 9 54 59 am

Crash frequency: Always


If I'll manually paste both files RNAppsFlyer.m and RNAppsFlyer.h into the project - everything will work, however from pods - it fails.

The second problem:

The manual way to integrate the module also fails with compilation error:

Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_AppsFlyerTracker", referenced from:
objc-class-ref in libRNAppsFlyer.a(RNAppsFlyer.o)

I found that new generated libRNAppsFlyer.a file size 2Kb less then for working version 0.48.

Full Stack Trace:


Showing All Messages
Ld /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/Demo_4_9.app/Demo_4_9 normal armv7
    cd /Users/maxim/Appsflyer/projects/react-native-appsflyer/demos/Demo_4_9/ios
    export IPHONEOS_DEPLOYMENT_TARGET=10.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.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 armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk -L/Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos -F/Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos -filelist /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Intermediates.noindex/Demo_4_9.build/Debug-iphoneos/Demo_4_9.build/Objects-normal/armv7/Demo_4_9.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=10.0 -Xlinker -object_path_lto -Xlinker /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Intermediates.noindex/Demo_4_9.build/Debug-iphoneos/Demo_4_9.build/Objects-normal/armv7/Demo_4_9_lto.o -Xlinker -no_deduplicate -fembed-bitcode-marker -fobjc-arc -fobjc-link-runtime -ObjC -ObjC -lc++ /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libRNAppsFlyer.a /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libRCTBlob.a /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libRCTAnimation.a /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libReact.a /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libRCTAnimation.a /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libRCTActionSheet.a /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libRCTGeolocation.a /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libRCTImage.a /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libRCTLinking.a /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libRCTNetwork.a /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libRCTSettings.a /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libRCTText.a /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libRCTVibration.a /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/libRCTWebSocket.a -lPods-Demo_4_9 -Xlinker -dependency_info -Xlinker /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Intermediates.noindex/Demo_4_9.build/Debug-iphoneos/Demo_4_9.build/Objects-normal/armv7/Demo_4_9_dependency_info.dat -o /Users/maxim/Library/Developer/Xcode/DerivedData/Demo_4_9-faoikaedeqmvmefyordscfynjfsd/Build/Products/Debug-iphoneos/Demo_4_9.app/Demo_4_9

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_AppsFlyerTracker", referenced from:
      objc-class-ref in libRNAppsFlyer.a(RNAppsFlyer.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Reproducible Demo

Download Demo

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: iOSiOS applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions