Memory leak with currentViewController in iOS keyboard expansion

I am writing a keyboard extension for iOS in Objective-C. At some point in viewController1

I present another view controller

CustomViewController *viewController2 = [[CustomViewController alloc] init];
[self presentViewController:viewController2 animated:NO completion:nil];

      

The problem occurs in the following scenario: Another application is open with my extension as the active keyboard. viewController2

and the extension exits (by pressing the home button). When the app restarts, it is viewController2

no longer displayed, but it viewController1

is. From memory consumption I can see what viewController2

is still in memory. Repeating the steps at this point quickly fails due to too much memory consumption.

This does not happen when normal user actions are performed in viewController2

, after which

[self dismissViewControllerAnimated:NO completion:nil];

      

... Also, I made it 100% sure that there are no strong references that can leak memory. I also tried to get a message when ( viewWillDisappear

etc.) is called dismissViewControllerAnimated:NO

, but it seems that pressing the home button instantly kills the extension.

viewController1

is UIInputViewController

and acts as a delegate for CLLocationManager

, but UICollectionView

, viewController2

is UIViewController

and does not act as a delegate at all. I do not support any links from viewController1

to viewController2

, and weak from viewController2

to viewController1

.

@property (weak, nonatomic) viewController1 *parent;

      

Does anyone have an idea what's going on? What can I do to prevent this?

Many thanks for your help!

+3
ios memory-leaks objective-c cocoa-touch


source to share


No one has answered this question yet

Check out similar questions:

3044
Making a memory leak with Java
1665
How can I get the UITextField to move upward when there is a keyboard - when starting editing?
1146
performSelector may leak because its selector is unknown
1042
The result was a leak of the window that was originally added
650
Xcode 6: keyboard not showing in simulator
422
iOS - Disable keyboard on touch outside of UITextField
372
An easy way to remove the keyboard?
204
Are memory leaks ever?
155
Anatomy of a "memory leak"
6
Internal keyboard memory leak?



All Articles
Loading...
X
Show
Funny
Dev
Pics