Something very strange UITextView in iOS 7 ... not in iOS 6?
Asked Answered
E

3

10

I'm creating a UITextView:

greetingTextView = [[UITextView alloc] initWithFrame:greetingRect];

Using it fine, but when the ViewController it is attached to deallocs I'm getting memory leaks ONLY in iOS 7 ? I'm even Nulling the greetingTextView out of desperation but to no effect:

    [greetingTextView.undoManager removeAllActions];
    greetingTextView.delegate = Nil;
    [greetingTextView removeFromSuperview];
    greetingTextView = Nil;

The leaks are in this image:

enter image description here

So it appears something to do with the UITextView UndoManager ? But why only in iOS 7 ?

Regards

Edita answered 31/10, 2013 at 12:14 Comment(8)
did you find the answer? I am also facing the same issueRunck
Sorry no :( , maybe it;s a feature lolEdita
I have the same problem, do you have any new information about this specific issue?Sunbonnet
Experiencing the same stuff, no solution for now.Prater
Nil is not the same as nilIdel
technically Nil and nil are different, nil is the id of a null instance and Nil is the the id of a null class, but in practice they are defined thus so it makes no difference in this case: #define nil __DARWIN_NULL #define Nil __DARWIN_NULLEdita
I'm getting the same leak. Maybe its a bug in iOS7? (I see its also there in iOS7.1)Crankle
And I've tried rewriting a totally new sample that just sets up an editable UITextView. As soon as you edit the text then exit the viewController it leaks the undoManager as shown above. I also tried a few bits of sample code from elsewhere (e.g. Ray Wenderlich) and it has exactly the same issue.Crankle
L
0

I face a similar situation, and after hunting around and some trail and error, i noticed that when ARC is disabled for that particular file, the strange behavior stopped and no memory leaks occurred. check here for how to disable arc for a particular file

Loney answered 17/1, 2014 at 11:58 Comment(0)
B
0

You'll need to empty out the undo manager if you want any object you add to it to be released.

Review the steps laid out in this document :

https://developer.apple.com/library/ios/documentation/cocoa/Conceptual/UndoArchitecture/Articles/CleaningUndoStack.html

Berton answered 17/3, 2014 at 16:41 Comment(0)
S
0

It did occurs to me once when I didn't specify the delegate of a UITextField. After the delegate was set everything went normal. Hope it helps. BTW, I'm using Storyboard.

Sillabub answered 25/6, 2014 at 2:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.