Skip to content

fix(ios): build failure when using custom native marks#102

Merged
oblador merged 1 commit into
oblador:masterfrom
hardworker:fix/ios-custom-marks
Jun 15, 2025
Merged

fix(ios): build failure when using custom native marks#102
oblador merged 1 commit into
oblador:masterfrom
hardworker:fix/ios-custom-marks

Conversation

@hardworker
Copy link
Copy Markdown
Contributor

Build fails on importing RNPeroformance.h in Objective-C file, because chrono is a part of STL library which cannot be found in plain Objective-C files. The idea of fix is to prevent it to be included in a header.

RNPerformanceEntryWasAddedNotification declaration and initialization were split to prevent build failure as well.

Build fails on importing `RNPeroformance.h` in Objective-C file, because `chrono` is a part of STL library which cannot be found in plain Objective-C files. The idea of fix is to prevent it to be included in a header.

`RNPerformanceEntryWasAddedNotification` declaration and initialization were split to prevent build failure as well.
@oblador
Copy link
Copy Markdown
Owner

oblador commented Nov 7, 2023

Hi, and thanks for your PR! As this doesn't seem to be an issue for myself or others, I'm curious of your setup. Do you use a very old version of React Native? Are you using native markers along with JS based?

@hardworker
Copy link
Copy Markdown
Contributor Author

Hey, @oblador! No, I use a pretty recent 0.72 React Native. Native markers are used alongside JS ones.
However it doesn't matter how you use them, it's only about importing <react-native-performance/RNPerformance.h> in a pure Objective-C file.

Here's an example based on a clean RN template: https://github.com/hardworker/react-native-performance-test-app

@Augustach
Copy link
Copy Markdown

Hey, @oblador.
Could you please take a look at example above?

@satya164
Copy link
Copy Markdown

satya164 commented Jan 23, 2025

This is the error I get when building the app when using custom markers on iOS:

[MyApp] Compiling AppDelegate.mm
❌ /Users/name/Developer/MyAppMobile/ios/Pods/Headers/Public/react-native-performance/RNPerformance.h:2:10: 'chrono' file not found (in target 'MyApp' from project 'MyApp')
    /Users/name/Developer/MyAppMobile/ios/MyApp/main.m:4:9: note: in file included from /Users/name/Developer/MyAppMobile/ios/MyApp/main.m:4:

I applied the changes in this PR and the app builds successfully.

I'm on react-native@0.73.8.

Edit: The issue seems to be fixed by renaming main.m to main.mm

@oblador oblador merged commit b275a39 into oblador:master Jun 15, 2025
r0h0gg6 pushed a commit to r0h0gg6/react-native-performance that referenced this pull request Jul 27, 2025
Build fails on importing `RNPeroformance.h` in Objective-C file, because `chrono` is a part of STL library which cannot be found in plain Objective-C files. The idea of fix is to prevent it to be included in a header.

`RNPerformanceEntryWasAddedNotification` declaration and initialization were split to prevent build failure as well.
@hardworker hardworker deleted the fix/ios-custom-marks branch January 20, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants