iOS 5.1.1 memory management without Automatic Reference Counting - ios

I have some strange problems of memory management on iOS 5.1.1, I'm NOT using Automatic Reference Counting in the project. Everything works well on iPad 3 5.1 or other devices with 5.1 or lower, this issue happens to two different project (one game and one app). So I think I have coded the right retain/release stuff.
Generally some Objective-C objects are released before it should be. When access it later, app crash. This happens on an iPad 3 LTE, an iPad 3 Wifi and an iPod Touch 4, all running iOS 5.1.1. It never happened on any device running iOS 5.1 or lower. I haven't found any pattern for this. Sometimes even an UIView which is still one the screen get released, if user touches a button, app crashes.
I understand these kind of issue can be debugged with NSZombies. But when I enable NSZombies, this kind of problem never happened.
It looks like a bug of iOS 5.1.1 to me, I'm wondering if it can be fixed on app side.

Related

Xcode 9 compiled app and iOS 9.5.3 (iPad 2)

Anyone noticed issues with apps that are created with Xcode 9 and do not seem to work on iOS 9.5.3 and in this case an older iPad 2?
I have a customer that downloaded my app that I’ve complied and uploaded with Xcode 9, but when he installs the app it crashes straight away, and on some occasions in a flash of 2 sec. will display the interface builder screen layout of the app (ie all the views, buttons etc that are visible on interface builder but with a normal app nicely hidden until needed etc).
The minimum development target in Xcode is set to 8.2 so I assume it will and should be backwards compatible?
Seems like the device is jailbroken.. My latest app version includes a check for a jailbroken device, and does not allow the app to load when it detects one.
I Could reproduce the exact behaviour when triggering this validation check.

Unity app crashes on iPhone 6 ONLY?

I have deployed a game made in Unity via TestFlight and do not know what to make of this issue - the game runs perfectly on all iPhone 6s and above. On iPhone 6 however and an iPad, it crashes right after the splash screen.
Crash report said initially it had to do with the Metal graphics settings - since (this is another problem) I haven't been able to get the crash reports from the last 2 builds, I am led to think it is still a graphics problem.
I've googled everything and found a few threads saying it was a Unity 5.5.0 problem and also that older devices do not support Metal. So today I updated to Unity 5.5.2f1 and removed Metal from the Graphics settings as
various links have said this has been an issue - https://forum.unity3d.com/threads/crash-on-startup-5-5-0f1-ios-10.446813/
https://issuetracker.unity3d.com/issues/ios-crash-on-presentrenderbuffer-gl-renderbuffer-in-presentgles-when-loading-a-scene-on-iphone-6s
but even with OpenGLES2 and 3 both in the options with Metal removed, it still crashes on just these older devices.
What is happening here? How can I fix this?
I am on the most updated Xcode, etc.

Cocos2d game doesnt launch on some devices

I're released an iPad game which is developed on the Cocos2d framework. Ive tested the game on a number of devices iPad 3, and iPad 2 and never had any issues.
Now i'm getting a few reports back that its not launching properly on some devices. People are saying they are seeing the default.png images then the app is closing.
Any ideas?
Without crash report this is just a guessing game.
By all means try to reproduce the problem on your side.
Possible problems:
1. If the app takes too long to launch it will be closed by iOS.
2. If it does not have enough memory it will not launch as well.
Try the following:
I. Open many other heavy apps in the background so there is not much memory.
See how it affects your app launch.
II. During launch try to use as many fast taps as possible and fast gestures.
There is possibility that very early taps are not serviced properly or at all
and that can cause the crash.
III. Test on many devices as you can - especially low end.
I found the issue, it was to do with the social framework running on older devices where it isn't available.

iOS app runs out of memory without receiving a low memory warning

I have an existing app that I made some recent changes to and I have been testing those changes. The app works perfectly fine on every iPad I test it on (iOS 4 and iOS 5). After loading several (50+) image-heavy views in my app I get a low memory warning and my viewDidUnload methods get called and they properly nil out all of their controls and my in-memory image cache clears itself out and the app continues just fine.
However, on an iPhone 4 and iPhone4s (iOS 5.0.1 and iOS 5.1) I run into a problem where my application runs out of memory without ever receiving a low memory warning. After loading several different views, eventually a new view will come up and be mostly blank and on the console I see memory allocation messages and the whole phone becomes un-responsive and sometimes kills my app.
The particular view that this happens on is different every time, so it's not related to any one view, just the accumulation of memory over time. I have also confirmed that I don't have any memory leaks either.
This existing question is similar:
IOS app killed for Low Memory but no Memory Warning received
and that answer suggests that this could happen if I'm stuck in a loop, but I'm pretty sure that my code isn't stuck in any loops. I'm just clicking through from one view to another in a UINavigationController and several images load in each view. Also, the other question was specifically happening on an iPad where I'm not seeing this issue on an iPad, only iPhones.
BTW, I've tried registering for the low memory notification through NotificationCenter and have an applicationDidReceiveMemoryWarning method in my app delegate and have breakpoints at both and neither get called. Also, no low memory message shows up in the debugger console either.
Any ideas on what might be happening?
Added on 3/26/2012:
Interestingly enough, when I tested my app on the new iPad, it has this same problem that I'm seeing on the iPhone 4 and 4s where the low memory notification is not being received. So I'm wondering if I'm seeing the same problem as this other thread:
The New iPad: Low Memory Warnings Not Appearing?
but that the developer on that thread is testing an iPad-only app and therefore not testing and finding this same problem on any iPhones.
I have done some extensive testing and have a list of devices where I properly received the low memory warning and devices where I don't ever receive it. So far I only see the problem on iOS5 or greater, however on iPad1s with iOS 5.0 and 5.1 I don't see the issue, so it's not just a problem on all devices on iOS 5.
Here is that list:
Proper Low Memory Warning
iPad1 4.2.1
iPad1 5.0
iPad1 5.1
iPad2 4.3.3
iPhone3G 4.2.1
iPod 3G 4.3.3
iPhone4 4.3.3
No Low Memory Warning
iPhone4 5.1
iPhone4s 5.0.1
iPad3 5.1
I've been banging my head on similar problems for the past week. I'm doing something different but with images so somewhat related.
You don't say where all those images are located - hopefully you write them to the file system, then load them into views using [UIImage imageWithContentsOfFile] (or if using CGImageRefs, then use a CGImageSourceCreateWithURL). What you want to avoid is having the images in memory (no swapping in iOS!).
in my case I had some mmap memory to hold the images, I had even unmapped the memory (which syncs it to the file system), but since syncing takes so long, I was being "charged" for that unsynced memory. What I did was essentially call fcntl(fd, F_FULLSYNC) on each of these files to force the system to flush each block before I continued.
I'm working on an app with tons of big images, on an iPad 3.
If I set iOS 5.0 as the Deployment Target, applicationDidReceiveMemoryWarning does not get called if the app consumes too much memory, and the app crashes.
However, applicationDidReceiveMemoryWarning does get called if I set iOS 5.1 as the Deployment Target. The OS thus flushes the cache containing the images that were previously loaded and the app doesn't crash.
The main problem is that I use UIImage imageNamed: to load my images, if your images are big use UIImage imageWithContentsOfFile instead so that they don't get cached (which is an issue if the size of the #2x is very big).
Note that if I display many images very quickly, applicationDidReceiveMemoryWarning doesn't get called in time in iOS 5.1, and I crash!
Can you try running in Instruments for the "Time Profiler" tool? It'll tell you if you're CPU bound in a different thread (though unless you create them yourself I'll be surprised if that's the case). Also good to run the "Allocations" instrument if that doesn't reveal smoking guns.
I have found exactly the behaviour on an iPad 3 running iOS 5.1. applicationDidReceiveMemoryWarning does not get called, nor NSNotifications for UIApplicationDidReceiveMemoryWarningNotification. I also tested the exact same code on some other devices, so you can add these to your list:
Proper low memory warning
iPad 2 5.0.1
iPad 2 4.3.5
iPhone 3GS 5.0.1
No low memory warning
iPad 3 5.1
The pattern could be: iOS devices with 512 MB or 1 GB memory running 5.0.1 - 5.1.
I'm not doing any heavy UIImage handling in this app. It seems that the behaviour from the OS has changed - either it is deliberately killing apps more aggressively (e.g. trying to be smarter about killing apps that look as though they have too onerous memory usage), or the low memory notifications are just broken.

UIStepper not shown but did not crash in 4.3 simulator

I just created a UIStepper programmatically and added it to my view.
in IOS 5 simulator it is working fine.
In IOS 4.3 simulator it is not showing up. Ok, becuase it is not supported in 4.3 , it seems fine. But app is not getting crashed.
Can anyone explain why ??
Thanks
-Mia
So Stephen is correct to say you shouldn't take what happens on the simulator as gospel, but in this case that's not what's happening.
The reason it doesn't crash is that UIStepper actually exists on iOS 4.3 - it's just not implemented. It's a private, undocumented class (you can view the 4.3 private framework headers here). Presumably Apple started integrating it into 4.3, but only made it public in 5. This happens a fair bit: gesture recognizers had been kicking around iOS for some time before they were publically released for iOS 3.2
It's a simulator not an emulator. Operations will be similar to but not the same as on an actual iPhone. In this case I wouldn't expect the same behavior on a real device.

Resources