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/
Related
Ok,
I've spent a few hours trying to find an answer to this question and had no luck what so ever.
I am creating an appium automated test using xcode Version 9.3.1 I need to locate the .app file so I can add it to my desired capabilities and I cant find it in any folder.
Breaking it this down in the most basic fashion, how do I locate the .app file so I can add it to my ios appium automated testing?
Out of curiousity would I need to use something like homebrew to locate it?
Or can I find from a specific menu in xcode?
Xcode -> Preferences -> Locations
Press the button to open folder in Finder
Here you need to find project build folder, open it and search sub folders with Debug-iphonesimulator name, you should fine build file there.
The full path might look like:
/Users/<user>/Library/Developer/Xcode/DerivedData/<Project name>/Build/Products/Debug-iphonesimulator
By default Xcode stores the derived data for all projects in a single shared folder under your home directory at the following location:
~/Library/Developer/Xcode/DerivedData
From Xcode 6, you can access or change derived data location from Preferences -> Locations Tab
but you can setup in xcode:
File-> Project Setting
locate "Derived data:"
here is how to setup https://www.youtube.com/watch?v=MVVRsR9XenQ
Seriously thank you so much for all your help. I really appreciated it so much. You've all been a bunch of legends. I was able to solve this problem and and I want help save someone 3 days of trouble.
Finding the .**app file is a HIDDEN FILE **
Basically there are number of ways to find the .app file in this version of Xcode.
You can find the .app by using your search bar on the mac. Also, you can find the .app would be in this directory
users/(YourMacAccount)/Library/Developer/Xcode/DerivedData/UICatalog-.../Build/Products/Debug-iphonesimulator/(appname).app
to reveal the hidden files type cmd>shift>.
If you still can't find it (Which is what happened to me). Then:
Click the show in finder icon (the one shaped like a file) in xcode
This is where you can find it in xcode 9.3.1
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.
I'm using xcode 6. Its fine to clean but it fails when I choose clean build folders.
Seems like you are restricted to create a build folder in your system root.
In XCode Menu --> Preferences --> Locations Tab --> Locations sub-tab, Change Derived Data to Relative and give any name in text box.
Have a look here which is also a permission problem in Xcode.
It could be due to Xcode bug (at least for me in Xcode 6.3.1). Toggling the location for derived data folder will fix it.
Go to Xcode > Preferences > Locations and change Derived Data to Relative, then back to Default.
Clean build folder again.
I just clean that folder in Finder, then all fine.
In Xcode 14 I clicked "Clean" command which had popped up in the 3rd row from the top and that fixed it.
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.
I am writing a program in Objective-C using Xcode. My program creates a file as follows:
[#"" writeToFile:fileName atomically:YES encoding:NSUTF8StringEncoding error:NULL];
I would like the file to be created in the same directory as the executable. When I run the program from Xcode, the file is created in the debug directory as expected.
However, when I run the .app file, the file is created in the root directory. How can I get the program to create a file in the directory where the .app file is located.
Thanks a lot.
EDIT: This is a MacOS application
EDIT2: Well, it seems that I shouldn't be writing to the .app directory. Thanks bbum and Paul R. What is the proper way to do it? To be more concrete, here's what I am doing: each time the user clicks a button in the application, a piece of hardware connected to a serial port will send a bunch data which will be written to a new file. This can happen any number of times while the application is running, so numerous files may be created. I would like them all created in the same folder.
You must never make any assumptions about the initial working directory for your application, as this will depend on what method was used to launch it (e.g. Finder, Terminal (via open), Xcode, gdb, third party utility, etc). You should use an appropriate API to find a suitable directory to store temporary files or user-specific files or whatever it is you need to do. This should never be within the app's bundle and never at a path that is relative to the initial working directory.
You do not want the file to be created inside the .app wrapper. That is never the right answer; your application may easily be installed somewhere where the current user does not have write access to the YourApp.app wrapper.
(For example, my main user account is non-admin and all applications are installed admin-write-only. If an app ever fails to work because it can't write to its app wrapper, the app goes in the trash.)
See this question for an outline of where files should be stored. Depends on the role of the file.