Cocoa NSBundle loadNibNamed deprecated -


i'm developing cocoa app , noticed nsbundle loadnibnamed deprecated.

i'm trying use sheet show config options. i'm using appcontroller , config sheet nib created separately.

this code.

- (ibaction)showconfig:(id)sender{     if (!_config) {       [nsbundle loadnibnamed:@"config" owner:self];    }    [nsapp beginsheet:self.config modalforwindow:[[nsapp delegate] window] modaldelegate:self didendselector:null contextinfo:null]; } 

using code, config sheet opens , closes perfectly.

when switch [nsbundle loadnibnamed:@"config" owner:self]; [[nsbundle mainbundle] loadnibnamed:@"config" owner:self toplevelobjects:nil]; config sheet still works fine.

my real problem when want close it. app crashes throwing error:

thread 1:exc_bad_access (code=exc_i386_gpflt)

this ibaction close config sheet.

- (ibaction)closeconfig:(id)sender{    [nsapp endsheet:self.config];    [self.config close];    self.config = nil; } 

once skip deprecated line, need close config sheet correctly?

i'm running yosemite , xcode 6.4.

is window property in app delegate class weak? if so, see this answer. not-deprecated method using requires controller have strong references top level objects.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -