App Keeps Respringing When Launched - ios

For some reason, whenever I try to run any app created in Xcode (even brand new ones), something happened (?) and now Springboard takes up a ridiculous amount of CPU until it launches. Once it's launched it's fine, but until then it will often respring if there's not enough memory. It runs fine in the Sim, just not on the physical phone. No clue why. I can provide logs or info, I'm just not sure what to put here; I've looked at most logs etc.

Where do you want to run the app? On a real device or in the Simulator? If you're using a real device, unplug it, open /Library/Developer/Xcode/iOS DeviceSupport and delete the folder with the iOS version of your device. After that, reconnect it. Does that help?
Also, please provide any logs you get and information about your system versions, devices and the Xcode version.

Related

How to debug react-native iOS app crashing on startup after a week or so

I started messing around with react-native. I've built a small application and it seems to work fine (package.json). I can work on it in Debug or Release mode, using the simulator or my iPhone 6S device, and all is well.
This app is just for me so I don't pay for the Apple Developer thing, and I just run the app in Release mode on my device, and it...seems to be fine? I can quit xcode and go places and the app works fine.
After a week or so, it's hard to tell, the app stops loading. It'll display the splash screen for a split second and then it's gone back to the home screen.
I setup Rollbar, but it doesn't catch anything. I look in the Privacy -> Analytics area and don't see anything there either.
I'm not really looking for an answer to my exact problem since various SO questions and other places suggest it's probably something weird and specific. My main problem is I don't know even where to look/how to debug this kind of thing. If I build the app and run it on device again, it'll run fine. I need to try to debug without loading new code, and have no idea how that works on iOS. I've tried poking around at the Debug -> Attach to Process by Name, but the app never gets far enough to do anything with that.
Alternatively, I throw react-native in the garbage and use something that works...
App provisioning with a free developer license (?) is 7 days. See: Why does my free XCode Provisioning Profile only last 7 days?
You can likely verify this by looking at error messages in the console window. Connect your device, and in Xcode go to Window/Devices and Simulators/Open Console, then launch your app.

Device gets restarted when trying to run App

I have a iPhone 5 device that i use to test the app i'm trying to run. It has enough storage and runs other apps as expected.
I'm trying to run my app through xCode with this device but before it will start the app it restarts the iPhone and is not able to enter the app.
I think it is a memory issue that is causing the device to restart but i'm not sure where to look as i have tried both Instruments on the Mac as well as checking the log for the device, but because the app restarts every time on start up it does not record the data.
Is there any other app or another method i could use to see if there are memory leaks.
Try to view your iOS Device Logs from your Mac:
1- Connect the iPhone or iPad you want to view logs for to a Mac by using a USB connection, be sure to unlock the iOS device as well
2- Open the “Console” app on Mac OS, found in the /Applications/Utilities/ directory
3- From the Console app sidebar, look under the ‘Devices’ section and select the iPhone or iPad that is connected to the Mac
4- Console Log data will begin showing up immediately for the connected iOS device
And then you can analyze what cause this issue
I've recently come across this error again with xCode. After taking some time investigating and debugging using instruments, it showed there were a few memory leaks taking place during the start of the app.
In our codebase there were a few places where there were objects that were not assigned weak/ unowned, causing the memory leaks for those objects being used on start up.
After assigning weak or unowned to those objects, it solved the memory leak issues I was experiencing in the app.
For reference I used this article to understand the problem better:
https://medium.com/flawless-app-stories/all-about-memory-leaks-in-ios-cdd450d0cc34
Medium Article on the differences and how to use Weak or Unowned on a object:
https://medium.com/hackernoon/swift-weak-vs-unowned-by-examples-ffcc7c25ecc8#:~:text=The%20main%20difference%20between%20weak,will%20crash%20the%20whole%20program.

How to disable automatic iOS device log syncing in Xcode?

Problem: Xcode will not let me debug a device until crash logs are synced. Crash logs take a long time to sync, and are rarely, if ever, relevant to what I am actually working on.
Scenario: Tester brings me a device to debug a special issue that I cannot test with the simulator. Since this device has not been plugged into any Xcode for months (if ever), I have to wait for Xcode to pull all the information off of the device before I may debug my issue.
Ideally, there'd be a preference somewhere to toggle until the rare case where I actually want this behavior. Note: I still want the device to log its crashes- I simply want my Xcode to not care about them.
Does this toggle exist?

My iOS app every now and then refuses to launch until I reinstall it

I've got an app that uses Core Data that sporadically stops launching so I have to reinstall it using XCode and then it launches again like normal for a while, with all the Core Data information still preserved.
I have seen that an app often stops launching when the target of an app is too low in comparison to the device software version, however this is not so for this app and device (iPhone 6s).
Have you had such an issue before? What do you think could be causing this problem?
There are many, many, many things that could cause an app to fail to launch. You need to narrow things down and collect some data so that you can find out what the problem is and do something about it. Right now you don't even know that it's related to Core Data, you're just guessing.
For a crash on launch, look at the device console and see what messages appear when you try to launch the app and it fails. You can get the device console messages by
Connecting your device to your Mac
Opening Xcode's "Devices" window (cmd-shift-2)
Looking in the bottom half of the window
A better way to watch the console is to use the free iOS Console app.
The problem was that, as mentioned by dan in the comments, the code was being signed for a short period of time (7 days) and so I had to keep re-installing it on the iOS device to keep it working. Thus to keep the app working indefinitely a paid developer account is needed.
Also mentioned in this reddit forum:
https://www.reddit.com/r/jailbreak/comments/4hotx3/news_free_developer_account_installs_reduced_to_7/

Device logs not appearing in Xcode

I have some crash logs which I am able to see in the iPad when I go to Settings->About->Diagnostics & Usage ->Diagnostics & Usage Data. But when I connect my iPad to the my computer and click Xcode->Window->Organizer->My Device Name, I am not able to see the logs at all. What might have been the issue? Any idea.
Better Method to take device logs:
~/Library/Logs/CrashReporter/MobileDevice/<your iPhone’s name>/
The device logs are now contained in SQLite databases in this folder:
~/Library/Developer/Xcode/iOS Device Logs
Clear that out and take control of your CPU from Xcode again! Once its cleared out then maybe you'll get it to show the one you want if to perform the crash again.

Resources