React-native-branch-deep-linking-attribution: Definition of 'tm' must be imported from module 'Darwin.C.time'

Created on 1 Oct 2018  路  4Comments  路  Source: BranchMetrics/react-native-branch-deep-linking-attribution

Since upgrading to XCode 10 I have been seeing this error only on trying to produce an archive. Exact error is:

/Users/luke/Projects/ssg-frontend-boilerplate/mobile/node_modules/react-native-branch/ios/BranchUniversalObject+RNBranch.m:88:15: error: definition of 'tm' must be imported from module 'Darwin.C.time' before it is required
    struct tm expiration;
              ^
In module 'Darwin' imported from /Users/luke/Library/Developer/Xcode/DerivedData/boilerplate-dzamshkxvccbuacllfatlobkvxvm/Build/Intermediates.noindex/ArchiveIntermediates/boilerplate/BuildProductsPath/Release-iphoneos/include/React/RCTUtils.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/usr/include/time.h:74:8: note: previous definition is here
struct tm {
       ^
1 error generated.

Dev works fine. I am seeing this across multiple projects that include this module.

Seen on:

RN v0.55.4 & react-native-branch v2.3.0
RN v0.56 & react-native-branch v2.3.3

Most helpful comment

Fixed it with:

rm -rf ios/build
rm -rf node_modules && rm -rf ~/.rncache
npm install
cd ios
rm -rf ~/Library/Caches/CocoaPod
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
pod install

react-native run-ios now compiles and launches the app, but when the app launches it crashes without getting past the Splash Screen. But that might be a problem on my end with other dependencies.

All 4 comments

I ended up having to roll back to XCode 9.4.1

I see this error a bunch too鈥o many bugs with React Native.

Seeing the same error when running react-native run-ios. Running from XCode after changing the build system to Legacy works just fine.

I was able to run react-native run-ios without getting this error for a couple days now, but since I've been upgrading multiple dependencies, including native dependencies like Sentry (react-native-branch isn't one of them), I got this error for the first time.

I have the exact same setup as @ssg-luke:

RN v0.55.4 & react-native-branch v2.3.0

Fixed it with:

rm -rf ios/build
rm -rf node_modules && rm -rf ~/.rncache
npm install
cd ios
rm -rf ~/Library/Caches/CocoaPod
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
pod install

react-native run-ios now compiles and launches the app, but when the app launches it crashes without getting past the Splash Screen. But that might be a problem on my end with other dependencies.

Was this page helpful?
0 / 5 - 0 ratings