Message from debugger: Terminated due to memory issue in device only
Yes, its possible that you may have silent complier about your warnings but it is possible that your app may over use memory i.e. memory is not optimised properly.
Message from debugger: Terminated due to memory issue.
Possibly there may be memory leaks or may be the memory overload (like view controller is remain in memory even after pop/dismiss due to strong reference to it.)
How to check:
You need to build app with profile (cmd + i) and select
Allocation
from the options and then test you app.You will see the all the view controllers that is being allocates and deallocates during testing.
Just identify the view controllers that are taking too much memory and try to optimise its memory.
Also you can identify the view controller that remains in memory (not deallocates) even after pop/dismiss.
Ios Xcode Message from debugger: Terminated due to memory issue
What device is this happening on? Once your app is in the background you can expect for it to be killed at any time - it doesn't have to be using excessive memory.
If the new foreground app wants more memory, the OS will give it as much as it can. It will send a memory warning to any backgrounded apps. If they don't respond by reducing the memory footprint, or the foreground app still wants more memory, then the background apps are killed.
Your app isn't crashing, it is being killed by the OS because it is no longer the foreground app and its resources are needed elsewhere.
Message from debugger: Terminated due to memory issue in Xcode 10.1...image array?
Keep Image names in an Array and in the dataSource get image name from array and construct image.
let imageArray = ["1", "2"]
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "MainCollectionViewCell", for: indexPath) as! MainCollectionViewCell
cell.imgImage.image = UIImage (named: imageArray [indexPath.row])
cell.lblImageName.text = nameArray [indexPath.row]
return cell
}
Note: If you still face memory issue then you might be loading heavy
resolution images, better resize them in background thread and assign
to imageView on main Thread.
Related Topics
Iphone:Daily Local Notifications
Indexpathforcell Returns Nil Since iOS7
Core Data Multi Thread Application
Check If Uicolor Is Dark or Bright
Uiviewcontentmodescaleaspectfill Not Clipping
Why am I Getting Ibtool Failed with Exit Code 255
Button in Uitableviewcell Not Responding Under iOS 7
Send Programmatically Sms on Jailbreak Device
Swift 2.0 Sorting Array of Objects by Property
How to Export Data to a CSV File with iOS
Synchronous Url Request on Swift 2
How to Add Line Break for Uilabel
Analysing Assets.Car File in iOS
Error When Trying to Obtain a Certificate: the Specified Item Could Not Be Found in the Keychain
Missing Cfbundleiconname in Xcode9 iOS11 App Release
When to Use Takeunretainedvalue() or Takeretainedvalue() to Retrieve Unmanaged Objects in Swift
Urlsession.Datatask with Request Block Not Called in Background