React-native: iOS 11.3 XCode 9.3 (9E145) don't build

Created on 31 Mar 2018  路  46Comments  路  Source: facebook/react-native

I've updated XCode to 9.3 (9E145) and iPhone X to 11.3 and now my project isn't building. It doesn't work with iOS 11.2 simulator too. But it works with react-native run-ios

Environment:
OS: macOS High Sierra 10.13.4
Node: 9.2.0
Yarn: 1.5.1
npm: 5.8.0
Watchman: 4.9.0
Xcode: Xcode 9.3 Build version 9E145
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: 16.0.0-beta.5 => 16.0.0-beta.5
react-native: 0.49.5 => 0.49.5

Steps to Reproduce

Update iDevice and Xcode then try to build.

Expected Behavior

Build success

Actual Behavior

Build fails.

/Users/*****/node_modules/react-native/Libraries/Text/RCTTextField.m:131:108: Values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead

RCTLogWarn(@"Native TextInput(%@) is %zd events ahead of JS - try to make your JS faster.", self.text, eventLag);

Enum values with underlying type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead

Sometimes it's RCTImage, RCTImageCache, etc..

iOS Fixed Locked

Most helpful comment

RN 0.49.3
Xcode 9.3
have the same issue

/node_modules/react-native/Libraries/Image/RCTImageCache.m:28:55: Enum values with underlying type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead

UPDATED SOLUTION (choose 1 from below)

  1. downgrade to XCode 9.2
  2. Upgrade to latest RN version
  3. manually apply the patch on multiple NSString stringWithFormat method which has %zd format

change %zd to %lld and add (long long) into respective format
link to sample patch:

was
https://github.com/facebook/react-native/blob/4a893ee071f76377a678fe9774190397f636598a/Libraries/Image/RCTImageCache.m#L27-L28

after apply patch:
https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Image/RCTImageCache.m#L25-L26

All 46 comments

Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.54?

Thank you for your contributions.

This is my problem, too. I have xcode 9.2 and ios 11.3. I am too new at coding to know how to post an error message. Sorry.

This picture is the error message I receive.
"Could not locate device support files.

This iPad Pro (9.7 inch)(Model A1674, A1675) is running iOS 11.3(15E216) which may not be supported by this version of Xcode."

I'm hoping to learn a work-around.

Same problem. I just updated Xcode to 9.3(9E145) and the same errors occur when I try to archive. Different part is building for simulator is fine, but only archive or building for generic iOS device have the problem.
I was about to submit a build, but suddenly can't upload a new build to itunesconnect. =(
Any clue?

Same problem.
react-native version: "0.42.0"
Xcode: 9.3(9E145)
Many type error happened with RCTLogWarn ?
(%zd?)

Same problem.
react-native version: 0.43.2
If i open my project with Xcode 9.2 it was built success. Open with Xcode: 9.3 was built failed with error.

Same problem.
react-native version: 0.46.4
Xcode 9.2 was built success, Xcode 9.3 was built failed.

Sam problem.
react-native: 0.47.2
xCode 9.3

Yes, problem appears only when trying to make Product -> Archive.

RN: 0.46.4
Xcode 9.3

I have other error:

/node_modules/react-native/Libraries/Image/RCTImageCache.m:28:55: Enum values with underlying type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead

RN 0.49.3
Xcode 9.3
have the same issue

/node_modules/react-native/Libraries/Image/RCTImageCache.m:28:55: Enum values with underlying type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead

UPDATED SOLUTION (choose 1 from below)

  1. downgrade to XCode 9.2
  2. Upgrade to latest RN version
  3. manually apply the patch on multiple NSString stringWithFormat method which has %zd format

change %zd to %lld and add (long long) into respective format
link to sample patch:

was
https://github.com/facebook/react-native/blob/4a893ee071f76377a678fe9774190397f636598a/Libraries/Image/RCTImageCache.m#L27-L28

after apply patch:
https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Image/RCTImageCache.m#L25-L26

Having the same issue with the same env of @teyou

At the end I downgraded the Xcode to 9.2 to archive the app. I just wondered why Apple doesn't mention this such breaking change in the release note of Xcode 9.3.

Xcode 9.2

@teyou Thanks for that. Updating React Native to the latest version breaks my iOS (and Android) build for a new set of reasons. I may need to use your suggestion.

@mickey13 you can also downgrade xcode.

I've been using the xcode beta when building the app through simulator and using an older version when archiving with xcode. It's annoying but a decent fix until you have time to upgrade react-native.

Has anyone reproduced this in 0.54?

I use @teyou 's solution 3 and modified about 3 ~ 4 files
Built successfully.

@peteroid thank you for the solution. It is a high risk to upgrade the RN version. For now, downgrading to Xcode 9.2 is the best solution.

@hramos I had a similar issue with 0.47 and after upgrading to 0.54 the build works.

Yeah cool, dowgrade to Xcode 9.2 works. Thanks for the solution.

@hramos Maybe this guy is on 0.54.4 and same issue? #18650

@hramos I don't have any problems on RN 0.54.4 running on iOS 11.3 with Xcode 9.3 (9E145)

I had the same issue using RN 0.47

Try to upgrade your RN Version via this guide: https://github.com/ncuillery/rn-diff

any workaround for older versions? (besides downgrading xcode)

I work on a company product, I am then releasing the app so Ic an downgrade the Xcode to 9.2 and make a work around for it. But what about other developers at different location? They are gonna think I messed up the code as I am the one releasing the code. Also my company has policy to not upgrade the RN version from 0.44.3 to any higher version. This is gonna be hassle.

@andrejunges You can use XCode quick fix tool (tap on the red circle).

Just quick fixing with xcode solved this for me, thanks!!

now i take the downgrade solution,keep watching

We must downgrade Xcode
Don't have any solution?

try this:

RCTLogWarn(@"Native TextInput(%@) is %ld events ahead of JS - try to make your JS faster.", self.text, (long)eventLag);

Upgrading the react-native: 0.49.3 to react-native: 0.55.2, now it working.

I try to upgrade RN 0.47 to RN 0.5x. But It have many issues and not working with other library old. Do you have this issue?!

I had merge conflict in android_manifest and a file that contain the numbers of build/certificates in iOS. I resolved this conflicts and now the iOS build works.

I tried update react-native from 0.48 to 0.54, everything seems fine - NO errors should be fixed.
If there are errors with third-party dependencies, don't forget to update them to the latest version.

To make @teyou's third solution work, I also had to cast eventLag to long in RCTTextView.m:238, RCTTextField.m:93 and RCTTextInput.m:90 (i.e. replace eventLag by (long)eventLag)

with React Native 0.55 it's ok 馃憤

@teyou's third solution + @antoinerousseau additions worked for me.
Thank you guys!

Yes it's risky to patch RN but it's a little safer if you create a patch script that's run in npm/yarn postinstall. That way, if you have to reinstall RN your patches will be automatically applied.

In package.json add:
"postinstall": "bin/patch33x.sh"

The patch script and data are in my gist.

Note that I'm patching RN 0.33 so my patch file may not work on your version. Some of the changes are the same as mentioned above, some are different.

I'm still stuck on RN 0.33 because I still support iOS 7. And I can't downgrade to Xcode 9.2 because my test device is already on iOS 11.3 (I sent in the phone for a battery replacement and it came back with the upgrade).

Thanks @teyou, @antoinerousseau and @edencakir .

EDIT:
I forgot to mention how to create the patch file, which you'll need to do, since you probably can't use mine.

With a clean react-native:

cd node_modules
cp -pr react-native react-native.orig

Then build with xcode, click on the little red dot, fix the error, and repeat till you've fixed all these casting errors. Then:

diff -Naur --exclude='*.plist' react-native.orig react-native > ../notes/rn33.3x.patch

Thanks @chetstone for the tips on the patch -- works like a charm!

RN 0.54.2 and 0.55.3

Xcode 9.3 archive success.

But when export archive select certificate, show error 'Profile doesn't include the beta-reports-active entitlement.'

Xcode 9.2 no problem.

Hi guys, I had same issue.
Try next steps:

  1. Close all js http://localhost:8081/debugger-ui in browser
  2. Open incognito/private window of browser
  3. Put app under debug mode(debug JS Remote)
  4. Clean project in xCode cmd+shift+k
  5. Archive

It's wierd solution, but wors for me, ty

image
image

Hi all,
Do we must to upgrade RN for this issue?
No anything solution other ?

@navata did u try my solution 'couz I did't upgrade RN

In Xcode just hover the error line and then you will find FIX button press it and re-Archive.

@peteroid How do you find Xcode version 9.2 in that link you posted?

@wkwyatt you can find in https://developer.apple.com/downloads/index.action (login with account Apple developer)

I confirm @areeb111 solution (and thank him): simply let xcode fix the issues in native code.

Then ensure closing previously running react-native server (react-native start) before starting after xcode auto-fixes

need help, I upgrade RN 0.46.4 to 0.54 and it gives so many errors like; react-native-impelementations (on checkbx) etc.

is there any solution without updating react native?
I'm gonna kill myself now

Mine seems to archive after update to 9.3.1

Was this page helpful?
0 / 5 - 0 ratings