objective c - NSWorkspace lauchApplication weirdness - it only works from within Xcode -


  @implementation बटन - (IBAction) doSomething: (id) pId; {NSFileManager * filemgr; NSString * currentpath; NSString * appPath; Filemgr = [[NSFileManager alloc] init]; वर्तमानपथ = [filemgr currentDirectoryPath]; एपपैथ = [वर्तमान पाथ स्ट्रिंगबैपिंग स्ट्रींग: @ "/ संसाधन / सिस्टमरन.एप"]; [[एनएस वर्क्सस्पेस शेयड वर्क्सस्पेस] ओपनफ़ाइल: ऐपपैथ विथ एपिकलीक्शन: नाइल]; बाहर निकलने के (0); } @end   

यह कोड पूरी तरह से काम करता है जब मैं & amp; Xcode से चलाना, या जब मैं Xcode के अंदर से "उत्पाद" को ठीक से क्लिक करता हूं हालांकि, जब मैं खोजक से आवेदन चलाता हूं तो यह कभी भी लॉन्च नहीं करता ... यहां तक ​​कि बहुत ही निर्माण फ़ोल्डर में से ... wtf?

अपनी संसाधन निर्देशिका को खोजने के लिए currentDirectoryPath का उपयोग न करें।

  NSString * appPath = [[NSBundle currentBundle] pathForResource: @" systemRun "का प्रकार: @ "एप्लिकेशन"];    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -