Device gets restarted when trying to run App - ios

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.

Related

iPhone restarts after API call

I am facing a very weird issue: my iPhone is restarting.
This issue occurs in a particular scenario only.
Step 1: I have a sync process in which I'm loading data for the whole app. So I'm basically doing a heavy API call by uploading 4-5 camera captured images and syncing the app data;
Step 2: After syncing, I'm pressing the iPhone home button to make the app go in background;
Step 3: I'm locking the iPhone screen(by using side button);
After a few seconds I'm seeing the apple logo and the phone seems to restart. This is not replicating when the app is connected in debug mode. I checked the debug navigator app is using only 125 MB of memory, disk and network values is 0%. Energy Impact is showing high, I'm not sure this is due to high energy impact. I'm facing this issue only on iOS 12.4.
The fact that the phone (or possibly just springboard) restarts, and not just your application means this is Apple's bug. You're not supposed to be able to crash iOS even if you try.
Finding a likely cause will be hard since the system is not behaving the way it's supposed to. The device's logs may have more information from things other than your app. This may be a system API breaking due to any number of actions from your application.
Often with this kind of thing the next OS version will fix it, but if that's not the case or it's important to track down I would try removing ways you're interaction with the system (background APIs, notifications, etc.) and see if anything fixes the issue.
If you find the problem, you may even be doing things the "correct" way according to the documentation and have to find a workaround. If you have the time you can submit a bug to Apple so the underlying issue has a better chance of being fixed.
It seems when your app is in the background and phone locked, Automatic Reference Counting (ARC) closes some connection or deallocates a resource that makes the iPhone restart. Are you closing all connections and removing all references once the upload is complete?
Phones do not spontaneously restart just because of an app’s actions. You’re having an issue with your phone, not with a program. You need to repair or replace the phone.

Application Failure Without Crash Log

Having perused many other questions concerning unusual app crashes without any success at solving my problem, I have decided to post this question.
I have an app that crashes at random. Some users (in test) never have crashes, others have an occasional crash. This app is installed via XCode on testers phones, straight from the development machine. The app never crashes when in use, only upon startup a day or two after installation and use.
The app is instrumented with Crashlytics, and no crashes are detected, nor are Out Of Memory warnings. No crash logs are left on the phone after this behavior.
Crashlytics works. I injected test crashes and they were properly detected.
Once the app crashes, it will not restart. The splash screens appears for an instant and then the app closes.
The app uses Core Data and I use ObjectiveRecord https://github.com/supermarin/ObjectiveRecord as the Core Data interface. There are no aborts anywhere in the code (at least none that I added/left in)
The app downloads about 1500 images (photographs) at initialization time, and whenever the photos collection is updated. The filenames are stored in Core Data, not the binary data.
As an experiment, I took the container from the same app on another phone and replaced the container on the defective phone. No difference. Replacing the container on the good phone with the container from the bad phone made no difference either.
If I reinstall the app on the target phone, without deleting the original install, all works as expected. This leads me to believe that I am not suffering from database corruption - obviously, I may be wrong, but if advice can be offered as to how to test this, I will happily accept it.
I am at my wits' end here - any advice as to what the problem might be, or how to diagnose the problem will be gratefully received.
EDIT -- The app is for IOS 9, iphone only.
I shall answer my own question. I have been distributing the app to my 4 testers using a MacBook. I only have one license, and rather than downloading it and moving it between my iMac and MacBook, I was just allowing Xcode to generate a new certificate.
This doesn't work. Ever.
It invalidated all of the copies of the app that I installed.
The moral of the story is: beware of licensing issues - even if you have a license.
and the hint was:
Aug 29 15:48:28 iPhone amfid[170] : /private/var/containers/Bundle/Application/25BE181B-C30F-41FF-87A3-88C8E63BB3B3/TEST.app/TEST not valid: 0xe8008018: The identity used to sign the executable is no longer valid.
Live and learn I guess......

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/

App Keeps Respringing When Launched

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.

ios app crashes on re-open

I've gone through and made sure the memory usage is good on my app and everything seems to check out. Most of the time when you switch apps and switch back, the app opens just fine. However, if you use the app a lot and then let the phone idle until it turns off and then turn it back on - the app will crash out after unlocking the device. How can I dissect what the reason is? Is there some kind of crash log kept on the device by chance?
*note I can't use xcode instruments for this particular situation because the phone will never idle it's self to sleep when connected to the cable and I can't get a crash by manually sleeping the device. I don't think idling to sleep is the issue, it's just something I have noticed before a crash happens.
You should be able to get to your device's crash log upon syncing.
OS X:
~/Library/Logs/CrashReporter/MobileDevice//
Windows XP:
C:\Documents and Settings\Application Data\Apple computer\Logs\CrashReporter\\
Windows Vista:
C:\Users\AppData\Roaming\Apple computer\Logs\CrashReporter\MobileDevice\\

Resources