bugsnag / bugsnag-react-native

Error monitoring and reporting tool for native exceptions and JS errors in React Native apps
https://docs.bugsnag.com/platforms/react-native
MIT License
369 stars 121 forks source link

TARGET_OS_IPHONE used when not defined #455

Closed jerrymarino closed 4 years ago

jerrymarino commented 4 years ago

The way that this define works is that TargetConditionals.h uses checks that are set implcitly by clang.

Before using TARGETOS* TargetConditionals.h should be imported or it won't work. Often in bugsnag this is implicitly imported by Foundation.h

bolsinga commented 4 years ago

alternately these .m files could import their own .h first (which has Foundation imports), and then read the TARGET_OS_* stuff.

bolsinga commented 4 years ago

It may be worth noting that this issue would be found if the Xcode build used no prefix headers or precompiled headers.

jerrymarino commented 4 years ago

@bolsinga where are you seeing a prefix header used? I didn't notice one in the repo or podspec. That being said, I noticed a few places that TargetConditionals.h wasn't imported, where this define is defined. Simply put, the code needs to import TargetConditonals.h in some shape or form before using this define

cc @xander-jones do you have any suggestions?

bolsinga commented 4 years ago

@bolsinga where are you seeing a prefix header used? I didn't notice one in the repo or podspec. That being said, I noticed a few places that TargetConditionals.h wasn't imported, where this define is defined. Simply put, the code needs to import TargetConditonals.h in some shape or form before using this define

This code doesn't import "TargetConditionals.h" anywhere manually, so the only way I understand that the .m files affected would compile "in the wild" is with some sort of a prefix header afaik.

mattdyoung commented 4 years ago

We believe this issue has now been fixed in https://github.com/bugsnag/bugsnag-cocoa/pull/654, released in v6.0.0.

Note: There are a number of breaking changes in v6.0.0 as part of an effort to improve the interface and make it more consistent across our error reporting libraries, so please refer to the upgrade guide: https://github.com/bugsnag/bugsnag-cocoa/blob/master/UPGRADING.md