Auto copy .app to Applications folder - objective-c

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.

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!!

Include exec files in osx app bundle

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.

How can one see an iOS bundle's file structure?

I'm trying to create a subfolder structure in my app following this advice:
Subdirectories within an iOS application
But I can't see (using the Organizer) a way to test whether the subfolder structure is actually achieved or not...is there a way to check, other than jailbreaking the phone and getting in through ssh?
You can open the bundle that is installed to the simulator by navigating to:
<User Name>/Library/Application Support/iOS Simulator/<Alpha-Numeric String>/<App Name>.app'
Once you navigate to the above location (it may be .ipa, can't remember exactly) you can right click and choose Show Package Contents which will show you the contents app bundle.
If the question relates to *.ipa or *.app boundles, then you can rename them to *.zip and go from there.
At the moment, with Xcode 10 and macOS 10.14.X the path for simulators would be:
/Users/<user>/Library/Developer/CoreSimulator/Devices/<XXX>/data/Containers/Bundle/Application/<YYY>
Also, if you want to check for the previous step and check the files that would be inside the *.app(bundle) in Derived Data (to check for devices) the path would be:
~/Library/Developer/Xcode/DerivedData/

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.

Why does Xcode 4 not add / create / modify any build directory when I do a build?

I recently upgraded to Xcode4 and noticed that my build/Release-iphoneos folder no longer gets populated with a .app or .dSYM file after I do a build.
**note - any build that is (build for running/testing/profiling). Also why is the build for archiving option gray'd out? in Xcode3 I was able to archive and build my .ipa w/ organizer
Am I doing something wrong or does the new IDE put a release build some place else?
Thank you in advance
By default it's placed in a new folder called 'Derived Data' within your Library folder. If you open up the preferences and go to the 'Locations' tab, you can change it back to the old location if you wish.
That is because Xcode 4 no longer uses that directory. If you look in preferences, you can both see where and change where Xcode 4 builds stuff.