objective c - Mac OSX open With function not working -


i want open image file in app using open function not opening here xcode settings

xcode plist settings

and here code of appdelegate

app delegate code

@property (assign) nsmutablearray *_allfiles ;  - (void)applicationdidfinishlaunching:(nsnotification *)anotification{     if (_allfiles.count >0)     {         [self openfiles:[_allfiles objectatindex:0]];     }     self.homeviewcontroller = [[homeviewcontroller alloc] initwithnibname:@"homeviewcontroller" bundle:nil];     [self.window.contentview addsubview:self.homeviewcontroller.view];     self.homeviewcontroller.view.frame = ((nsview*)self.window.contentview).bounds; }  - (bool)application:(nsapplication *)theapplication openfile:(nsstring *)filename {     [self application:theapplication openfiles:[nsarray arraywithobject:filename]];     [self.homeviewcontroller showalert:filename];     nslog(@"====%@",filename);     return yes; } - (void)application:(nsapplication *)sender openfiles:(nsarray *)filenames {     if(!_allfiles)     {         _allfiles = [nsmutablearray arraywithcapacity:1];     }     [_allfiles addobjectsfromarray:filenames]; } 

if want open file 'supported files' folder have say:

[[nsworkspace sharedworkspace] openurl:[nsurl urlwithstring:@"/applications/yourapp.app/contents/resources/yourfile.extension"]]; 

replace yourapp.app app.
replace yourfile.extension image.

note:
work if application located in application folder.
if it's not, have change path or put app there.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -