React native release building at iOS error - ios

Sorry, but I hate *pple. I have many reasons, and it is one of them. Debug version works fine even without any critical warnings, but release crashes at some screens
P.S.
XCode version 12.5
React-native 0.65.1

Step by step commenting and redeploying helped me to find the root of this trouble. Now, I know, but I can't understand why, you I can't pass custom methods to Array.prototype or Object.prototype. It worked with debug version without any troubles, but release didn't :(

Related

React Native App Crash (Thread 1: EXC_BAD_ACCESS (code=1, address=0x54))

Recently came onto this issue when trying to run my app on the simulator through xCode or the React Native CLI. The bundle loads from localhost then the app immediately crashes with "Thread 1: EXC_BAD_ACCESS (code=1, address=0x54)" in "main.m" in Xcode. I am unable to get the app running even though it builds fine. (even tried running on release instead of debug)
This issue just started recently occurring and I cannot find anything in our Git logs that would cause any kind of issue - all pretty minor changes on the RN side and nothing native. Has anyone seen this issue/knows how to properly trace it? Seems like a super generic error and it is unclear on how to figure out what is actually going on.
Xcode version 11.5, React Native 0.62.0, and targetting iOS 10.
EDIT:
After running the app a few times I was able to get this error in the Xcode Output
For me, running this watchman watch-del-all && yarn cache clean was what worked. I found it on an issue on github. Strange but it worked like magic
After tons of debugging, confusion, and many hours of frustration it came down to removing and readding one dependency. There was no specific error message I could trace or change I could find in our git history that would've caused this. I literally ended up tediously removing code from the App until I found the library that was the problem.

App Crashes Only On Testflight Build

I have created an app on swift and tested it extensively using iPhone 6, iPhone 6 plus and iPhone 5 devices and all the simulators offered in Xcode. The app runs fine and does not crash when uploaded locally. (iOS 8)
I finally submitted a build for Testflight. The app consistently crashes at the same place after downloading the app through the Testflight build.
Is there a known issue where uploaded builds run differently than locally created builds? And how can I debug the issue with the Testflight build?
I guess its a swift compiler issue. To verify first go to Edit Scheme then change the Build configuration to Release mode in Run tab and then install the build locally. You will get to know where exactly its crashing.
I solved the issue by changing the swift compiler optimization from fastest to none. I'm not sure if this is an ideal long term solution, but the build no longer crashes.
In my case this happened after starting to use Xcode 11. It was a UISearchDisplayController (deprecated since iOS 8) that seems to work on a device or simulator in debug mode, but not in the release build. Xcode 11.3 doesn't give any inline warning in the code.
The crash was hard to find, because the search controller wasn't used any more, it was orphaned code.
It might be the Bitcode related issue. Check if your all third-party libraries support bitcode then and then only set bitcode to YES else set to NO.
Actually Bitcode is an intermediate representation of a compiled program. Apps you upload to iTunes Connect that contain bitcode will be compiled and linked on the App Store.
For all those who face this similar issue, can follow these steps
Go to Xcode->widows->organiser then select crashes tab then select your app.
If you have added your apple account in Xcode->preferences-> accounts then you Xcode will download all crash reports even for the testflight build.
It will have the stack trace you don't need to symbloicate it like old times.
PS:- the most common which I have seen is UISearchDisplayController issue
For anyone still having this issue working with React Native, you can run this command to run it in release mode, the same when you archive a build. That way you can debug the issue easier:
react-native run-ios --configuration Release
In my case, changing Legacy Build System to New Build System (for Xcode 10) solves my issue where Testflight build behaves differently. Might be helpful to someone.
I got it (partially!). Actually "release" implementation of UI_USER_INTERFACE_IDIOM() in swift project crashes the app.
However, still I have no clue why our app store app (objective c language based) does NOT crash.
My only guess is that it's a glitch in UI_USER_INTERFACE_IDIOM() API implementation with some language specific coding (swift vs objective c) by Apple.
Anyways, I would replace all UI_USER_INTERFACE_IDIOM() with UIDevice(). userInterfaceIdiom. I hope this helps someone!
If anyone else is having the same problem, here's what my fix was:
I finally got the problem down to a loop with a if statement, akin to this -
while(condition)
{
if (check)
{
code!
}
//There was no code here
}
Notice that there's no code at the end of the loop (where the comment is). Once I added a random bit of code (in this case, incrementing a variable for output), the problem stopped.
while(condition)
{
if (check)
{
code!
}
i += 1;
output statement
}
I think this has to be a compiler error, or else my "fix" shouldn't be a fix at all. But here it is in case it helps anyone else!
Instead of i += 1; in the empty while loops.
I did this in my empty while Loop: RunLoop.current.run(until: Date(timeIntervalSinceNow: 1))
And now the TestFlight App does not bomb!
A shorter time might also work such as: RunLoop.current.run(until: Date(timeIntervalSinceNow: 0.25))
Release build actually takes a different entitlement file than debug build entitlement while debugging in local.
While uploading an archive build it will take release build settings and release entitlement file by default. Make sure you have all the release settings correctly edited in the configurations.

Launching app on iOS Simulator (waxsim no longer works)

I've had a workflow for a while that ran automated tests by building an app for the simulator, then launching it using waxsim. On every new sdk release there were some small tweaks to keep it working. However, XCode 5.1 removed the iPhoneSimulatorRemoteClient framework, so waxsim no longer works.
I tried using the ios simulator from the command line directly, as in:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication /mydir/myapp.app/myapp
However myapp does not run, I just get the simulator loading the home screen. I can't figure out what might be going wrong, since I can't find a way to get any verbose output - the simulator does not complain about anything, it just doesn't load my app.
Any ideas, thoughts? Perhaps an alternative to waxsim that works on Xcode 5.1?
ios-sim was recently updated to support the new private framework DVTiPhoneSimulatorRemoteClient that is present in the current Xcode/SDK. I tried it and it seems to work fine, so I pretty much answered my main question.
Still, if someone has an idea why -SimulateApplication does not work (when the same app launches fine with ios-sim), I'd be curious to find out.

Logging suddenly stopped working in iOS app with xCode 4.6

I am using xCode 4.6. I upgraded when it first came out, with no problem.
Today, logging suddenly stopped working in my app. It has been logging no problem since I first created the app (years ago), then today it just stopped.
I have tried:
*Cleaning the project
*Deleting the derived data
*Closing and restarting xcode
*Deleting the app from the simulator
*Resetting the simulator
*Searching to see if NSLog (or DLog, as I am mostly using, though I do use some NSLog as well) was redefined somewhere (they weren't)
I have looked at other posts on this site, and they have not helped the solve the problem. I really do not know what to do from here.
You may need to choose Debug Configuration in Schema Info.

Crash on device using ad-hoc distribution

Suddenly my ad-hoc distributions through Testflight and iTunes-sync no longer work. The application distributed using the ad-hoc build config never start fully on device. It crashes immediately with a segmentation fault 11.
The weird thing with this problem is that a debug build, on all the devices mentioned below, work flawlessly. This is causing me to believe that there is something messed up in my project.pbxproj. But when I look in the git-log I see nothing out of order, the only thing changed in there are the Architectures (ARCHS) and Valid Architectures (VALID_ARCHS).
Am I correct to assume that messing up the architectures should not cause an actual error on startup but during the build process?
Some Background:
Also worth mentioning is that I had both Xcode 4.4.1 and 4.5 GM installed, when I upgraded the GM to the one from App Store it removed my backup of Xcode 4.4.1 as well. After that hiccup I removed all version of Xcode, rebooted and installed version 4.4.1 again (this is so I can build for armv6).
Any helpful tips in how to proceed with this debugging is extremely valuable to me.
Thanks for your time.
<3
Console print and crash log from device:
- https://gist.github.com/3781018
I can add more logs if needed.
Current Environment:
- Xcode Version 4.4.1 (4F1003)
- Mac OS Version 10.8.2
Project Setup (pbxproj):
- https://gist.github.com/3780985
Devices tested:
- iPhone 3GS iOS 6
- iPhone 3G iOS 4.2.1
- iPad 2nd Gen iOS 5.1.1
- iPhone 4S iOS 5.1.1
- iPhone 4 iOS 6.0
- iPhone 4S iOS 6.0
Update
To proceed with the debugging this is what I tried:
1. Skip Testflight and use the old-school way of releasing an ad-hoc with iTunes. FAIL
2. Reinstalling the provisioning profiles FAIL
2. Create a new user on my machine an reinstall Xcode. FAIL
3. Build from another machine. FAIL
4. Set optimization level to: -O0 FAIL
Even though I was certain that none of the code had been changed, I saw no other reasonable explanation for this. So I started reverting the project in git, staring with the day I successfully made an ad-hoc release. To my horror I noticed that the same segmentation fault was following me through the fabric of time!
Considering this fact there was only one action left to take; a very powerful way of debugging I dubbed spray-and-pray. =) In other words I started to comment out sections of the code and see if that made any difference and to my complete surprise it actually did. After a few hours of disabling and enabling parts of my application I found the culprit: a static NSArray was never retained. What's really blowing my mind here is that the actual initialization of the array has been looking the same since 2010. So why on earth did this suddenly result in a memory error now? And why did the static analyzer not warn we about this?
I am too exhausted at the moment to answer those questions right now, I will try to update the question with more details and hopefully an answer as well tomorrow.
Once again, a big thank you for anyone who helped out so far! <3
It looks like the cause of the problem is the concurrency issue:
Crashed Thread: 1
In such a case it may be hard to find and resolve the root of the problem (http://en.wikipedia.org/wiki/Unusual_software_bug#Heisenbug).
May be you are doing something with one object from multiple threads without proper synchronization;
or may be you dealloc'ed object in one thread (ex. thread 0) and trying to access it from another (thread 1).

Resources