All Questions
Tagged with automatic-ref-counting ios
1,939 questions
1
vote
1
answer
35
views
Why is a CALayer retained after I stop referencing it?
I've the impression that my CALayer is retained after being added as a sublayer until the end execution block, instead of until I stop referencing it.
The parent UIView is however released as soon as ...
1
vote
1
answer
134
views
UIImage does not release memory
The code below is to reproduce what I encountered.
After loading and cleaning data, the memory is still not freed.
And the weirdest thing is that if I press the clean data twice, the memory could be ...
0
votes
0
answers
62
views
Sheet binded item doesn't deinitialize SwiftUI
Have the following scenario. Basically I want to use the item binded sheet init and bind it to an optional property which will be set when we want to show the sheet. On the outside it looks perfectly ...
1
vote
1
answer
54
views
How to make weak reference when setting function to closure variable
How to weak self when setting function to closure as in 1. to work same as example 2. Any ideas?
class TabController: UITabBarController {
func setupViewActions() {
tabView.itemTapped = changeTab //...
0
votes
0
answers
84
views
CoreHaptics [__NSDictionaryI dealloc] crashes EXC_BAD_ACCESS
I am receiving rare crash reports in the Objective-C plugin written for Unity iOS builds to play haptics via AHAP json format.
Relevant parts of the plugin code is below. "...
1
vote
0
answers
27
views
Memory allocation in swift [duplicate]
In swift, based on Apple's documentation reference types are stored on heap and value types on stack, but if a class definition has a struct variable for example String, where will that be stored?
...
0
votes
1
answer
110
views
Memory management issue while Call Obj-C in Swift
I'm currently developing a native plugin for a Capcitor app. I have very little experience with native iOS development, Swift and Obj-C.
I use a framework (FunSDK) which is written in C++.
I call this ...
0
votes
1
answer
168
views
Is using SnapKit causing memory leaks
I am using SnapKit to handle my AutoLayout. I am wondering does this code cause a memory leak because I am capturing self in a closure?
writtenUpSwitch.snp.makeConstraints {
$0.trailing....
0
votes
1
answer
435
views
How to cancel a thread in swift
I am facing a problem where a class instance is not being deallocated, so the app gets stuck. The class which is causing the problem is
import Foundation
class ResponseTimeoutQueue{
private let ...
0
votes
1
answer
153
views
iOS Memory management. Closures
I have a question about memory management in iOS.
As I know we have ARC that looks at a number of strong references to the object and once it's become 0 object will be deallocated.
Here is a code ...
0
votes
1
answer
66
views
Do I need to keep the reference to a singleton object to avoid repeated initialisation?
Imagine that we have some singleton object:
class Singleton {
static var shared = Singleton()
private init() { ... }
}
Am I right that if I don't keep the reference in some place, it is ...
3
votes
0
answers
276
views
Why does modern Xcode generate projects with UIApplicationMain outside of autorelease pool?
If I remember correctly, back in the days Xcode used to generate the main function something like this (at least for iOS applications):
int main(int argc, char * argv[]) {
@autoreleasepool {
...
0
votes
0
answers
58
views
Does Objective-C really set an uninitialized local object pointer to nil under ARC?
Recently I got a few EXC_BAD_ACCESS crashes from firebase when calling [NSString stringWithFormat:]. The code snipped is as follows:
#define TYPE_A @"typeA"
#define TYPE_B @"typeB" ...
2
votes
2
answers
752
views
Using @FocusState on a TextField causing memory leaks
I am learning memory and ARC since a while and managed to use the Leaks instrument more often in order to produce quality code. Having that said, please consider my lack of experience in this zone.
...
0
votes
2
answers
206
views
I am trying to create a custom UITabBar, but there is a memory leak caused when I present one of the tabBar's view controllers
I am trying to create a custom tabBarController, but it seems like there is a memory leak caused by presenting the different view controllers. I can see the memory usage climb when I toggle between ...