Questions tagged [strong-references]

Strong references are regular references that are protected from garbage collection, in contrast to weak references.

Strong references are regular references that are protected from garbage collection, in contrast to .

86 questions
0
votes
1 answer

How to prevent a value from strongly referring to its key?

A much better programmer than me informed me that he holds a map of his WebSocket connections with java-websocket in a WeakHashMap. I've looked into that map for myself and it seems perfect since a connection will close without the thread…
user1382306
0
votes
3 answers

iOS : dealloc is not getting called if strong delegate set to self

Say, I've a class (say "MyClass") of type UIView where I declared, a property of type (nonatomic, strong) for class delegate, to handle events will fire by the class. Application is ARC enabled, and it's working just fine, a time I found something…
Hemang
  • 26,840
  • 19
  • 119
  • 186
0
votes
2 answers

Which storage (weak or strong) for the elements underneath the "main" View in iOS7

After reading really many books and docs on iOS programming I am still confused - which Storage type (weak or strong) to select, when control dragging from a UI element underneath the "main" View? (and by "main" I think I mean the UIView assigned to…
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
0
votes
2 answers

UIViewController Retaining in ARC

I have a subclass of UIViewController -> MyPopUpViewController @protocol MyPopUpViewController Delegate; @interface MyPopUpViewController : UIViewController { } @property (nonatomic, strong) id
0
votes
2 answers

Objective C - Two Dictionaries using same values, strong or weak

I'm new to objective c and I've got an interesting situation where I need two different NSDictionary objects that point to the same values. In that situation should I use strong or weak in the property declaration? Or should I do strong in one and…
CamHart
  • 3,825
  • 7
  • 33
  • 69
0
votes
1 answer

ARC from strong - to - strong

I would like to know the correct approach here under ARC. I have strong NSArray(custom class Objects of my own) @property inside a controller and when I am init another controller I have to pass just one NSString from these arrays to another…
Gaurav18ca
  • 63
  • 1
  • 5
0
votes
1 answer

Why is my app crashes using __autoreleasing + __strong?

Here is my code: void autoreleasingReturn (NSError * __autoreleasing *error) { // --- Crashing *error = [[NSError alloc] init]; // --- Not crashing // *error = [NSError errorWithDomain:@"hello" // …
0
votes
1 answer

Is it bad to set two Views in a SplitView to hold a reference to each other?

I'm currently writing an RSS program in which my splitViewController's views have to talk to each other. Both of them currently hold a propertied instance of each other which is declared in the App Delegate as mentioned below. I want to know if this…
0
votes
2 answers

Setting strong references objects to nil with ARC enabled?

I am developing an iPhone app with ARC option enabled. i am creating IBOutlets in .h files which are connected from file owners icon to .xib elements.for eg. IBOutlet UIButton *bt; @property(nonatomic,retain)IBOutlet UIButton *bt; in .m file, i am…
-2
votes
1 answer

Swift: dynamically creating and assigning delegates

MKMapView's delegate property is defined as so in swift: @IBOutlet weak open var delegate: MKMapViewDelegate?. If I had to dynamically create map views for each item in an array whose length/count is unknown beforehand, how I dynamically assign a…
pnizzle
  • 6,243
  • 4
  • 52
  • 81
-2
votes
2 answers

Memory cycles = strong0 ^ strong1 pointers; (strong1 == weak) ? @"Yes" : @"No"

well I want to find out why there is a memory cycle in this case: @property (nonatomic, strong) NSArray *myBlocks; // and the method [self.myBlocks addObject: ^(){ [self doSomething]; }]; well the block has a strong pointer to self because…
1 2 3 4 5
6