Include exec files in osx app bundle - objective-c

Ive looked around a bit and cant find the answer I was hoping for, I am new to OSX dev so forgive me if this is a basic question.
Using NSTask I open up an exec file while my OSX is running that does stuff, I have to set a launchPath for this like so self.execFile.launchPath = #"/usr/local/bin/execFile";. This is fine when I'm running it on just my Mac, however, I would like to distribute this app. I am looking for a way to to save the execFile in, from what I gather so far from Googling, the apps bundle and call it from there, that way I can set the launchPath in the code and it would work on any computer. So far Ive only seen talk on how to access the app bundle but I don't know how to save a file there in the first place.

You must create a Copy Files build phase for your application target and add the exec files to the Copy Files build phase. Select your project from the project navigator to open the project editor. Select your application target from the left side of the project editor. Click the Build Phases button at the top of the editor. Choose Editor > Add Build Phase > Add Copy Files Build Phase to add the Copy Files build phase.
After creating the Copy Files build phase, click the disclosure triangle next to it. From there you can add files to the build phase and choose a location in the app bundle to copy the file. When you build the project, Xcode copies the files in the Copy Files build phase to the app bundle in the location you specified.

Related

how to create our own private library with xcode

I have written customise controllers in swift in xcode, and with git i have uploaded them on gitlab, now when i'm trying to clone this library with other projects, i had to add all files in xcode to use those files, it's pretty annoying though to add files if we want to use them, is there any other way to overcome this
Basically you want to maintain library files and add them all at once to your Xcode, follow these steps
go to project file -> Build Phases -> Copy Bundle Resources
and then click on + icon
select "Add Other..."
Select your folder
Now it will always build your library files along with your project files.
Hope this Helps!!

Auto copy .app to Applications folder

When I click Product -> Archive for a Mac app in Xcode 6, I want the .app file to be automatically copied to the Applications folder replacing the earlier copy.
I've noticed there are post build actions for the Archive scheme but I don't know how to achieve this.
Basically you will want to add a custom shell script phase.
You could do any number of things there.

Making .exe to be run on another computer without installation

Is there any way to make an .exe file run on another computer without installation ? .
The app is quite simple without any resources except one picture.
It has one form, one button and on Form_Load it needs to show picture.
Do I need to make an installation for that ?
No, what you need to do is to first add the picture to the project (on the menu system click Project | Add Existing Item . . .) if you haven't done that yet, and then click on the file in Solution Explorer and set its Build Action in the Properties Window to "Resource." This will ensure the picture is written into the exe file when you build the application, and you won't have to worry about copying it along with the application.
Select the "Release" build configuration, and then click Build | Rebuild on the menu system to have your application copied to the Bin\Release folder of your project folder. From here you can copy and run it on any computer that has .NET installed.

Is there a way to exclude some files from submitting to the iOS app store

I am working on an app that i would like to submit to the store and i have some files that is part of the project that i don't want to be part of the archive.
For example some viewcontroller files that i made but are not going to use for this version of the app or some data files that i am reading into the database that not needed in the release.
Do i have to delete everything before creating the archive or i can some how choose for them not to be included. Also some of the viewcontrollers on the storyboard are extras would i have to delete them also?
Thanks in advance!
Only files that are part of the target you're archiving will be included in the archive and submitted to the App Store. You can add or remove files from a target by selecting it and editing the checkbox in the file inspector panel on the right:
To see all the files that are included in your target, select your project in the file browser on the left. Then select your target and the Build Phases tab.
Under Copy Bundle Resourses you'll see all the resource files that will be added to your app's bundle (and the archive).
You can selectively exclude files from your Xcode project:
In your project settings, select your target. In your target, select Build Phases pane. From there, you can exclude compilation sources and bundle sources via the "Compile Sources" and "Copy Bundle Resources" lists.

Moving .lproj file inside Resources

I'm trying to begin localization on a project, and I've already got an English version of Localizable.strings going. I'm now trying to add French to that file, which is creating an fr.lproj folder, as I'd expect. However, it's putting it in my project root, and I'd like it inside my project's Resources directory.
Xcode seems to have no interest in letting me move the file, and if I move it in Finder, it goes red in Xcode as expected, but doesn't let me click to locate the file.
I've tried moving it in Finder, then editing project.pbxproj in a text editor to add Resources/ in front of the only line in there that mentions fr.lproj/Localizable.strings, and that has worked, but after doing that, the project's targets also turned red in Xcode, and building the app doesn't change that fact. Very odd.. any idea what could be going on, or how to get this going?
This can be a real pain. I even had XCode crash on me when trying to correct unwanted file locations. I found that the best way is to create the localized file (be it .strings or .xib) as a copy of the source language version outside of XCode, then drag and drop it into XCode. If you do this then XCode will display it correctly and your targets' Build Phases > Copy Bundle Resources settings will include it with its correct location. I don't know why your targets are displayed in red, perhaps you could look under Copy Bundle Resources in case anything is wrong there, or also select your project and click Validate Settings in case you haven't already done so.
Also, if you have been testing in the simulator beware of how XCode does not clean up the files in your app bundle--you may want to delete the app and run it again to make sure it's working with your new location.