objective c - Opening 'New' Document? -


i have code implemented in mydocument.m file attempts load last used document upon launch. however, upon launching fresh install, (or running after deleting last used file) 'new' document window not appear. know add code this? here is:

- (bool)applicationshouldopenuntitledfile:(nsapplication *)sender {     nsurl *lasturl=[[nsdocumentcontroller shareddocumentcontroller] opendocumentwithcontentsofurl:lasturl display:yes error:nil];     if (lasturl!=nil)     {      [doccontroller opendocumentwithcontentsofurl:lasturl display:yes error:nil];             return no;     }      return yes; } 

- (bool)applicationshouldopenuntitledfile:(nsapplication *)sender {     nsarray* urls = [[nsdocumentcontroller shareddocumentcontroller] recentdocumenturls];     if ([urls count] > 0){         nsurl *lasturl= [urls objectatindex: 0];          if ([[nsdocumentcontroller shareddocumentcontroller] opendocumentwithcontentsofurl:lasturl display:yes error:nil]){                    return no;              }            }      return yes; } 

edit

i changed , tried out should work now.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -