find project path in derived data folder in xcode 8 - swift

i have searched a lot but can not find a helpful link to find project location in derived data folder using swift in xcode 8.
Please help me regarding this issue.

You can run this in the command line using grep, and you'll have the DerivedData build folder of your project.
xcodebuild -project projectName.xcodeproj -showBuildSettings | grep -m 1 "BUILD_DIR" | grep -oEi "\/.*"

You can't get this path with Swift from your app: the "Derived Data" folder is only useful for Xcode, not for your app, which doesn't "see" it at all.
Xcode is the IDE and uses the folder when building your app - but your app is not aware of Xcode or its folders, your app is independent from the IDE.

With xCode, a simple way to the find the Derived Data path is to Build your target.
This does NOT run the target. But you can see the Derived Data folder on your machine.

Related

Convert regular xcode application project to iOSOpenDev

I'm new to jailbroken dev. I have a regular xcode application project. Now I need to convert it, or create a new application project using iOSOpenDev for jailbroken dev. I found the same question:
xcode project conversion to iOSOpenDev
But I have no idea what to do with the first step. Do I need to add some settings or change some values of existed settings? Pleas give some more details.
thanks!
About the first step, I did some tryings and it worked out. The following steps is just the same as kokoabim said:
1.change the install path to /Applications; add iOSOpenDev's include,lib,framework folder path to Framework Search Paths,delete iphonesimulator from Supported Platforms in Build Settings, Header Search Paths, Library Search Paths(I'm not sure if it's necessary);
Add a run script build phase (must be last in order) to existing target that executes /opt/iOSOpenDev/bin/iosod --xcbp.
3.Create the Debian package control file under the existing target's folder as (target's directory)/Package/DEBIAN/control.
4.Perform a Build For Profiling (Cmd-Shift-I).

Xcode: Warning: Multiple build commands for output file AND error: unable to open executable ''

I've been reading countless other posts and trying numerous fixes, but nothing has worked for my problem. I'll preface this by saying that I haven't used Xcode on this Macbook in some 2-3 months. This is the only project (out of the 4 or so I've tried) that has this problem. The first thing I did after opening Xcode was I changed the name of the project as well as a .h and .m file. I did all of this through Xcode, not Finder.
Nothing is appearing in the Navigator in red text which would indicate that it can't be found. Here is what I've already tried (many times).
Close/Open Xcode.
Clean both the project and build folder.
Delete Derived Data folder.
Ran a Disk Utility to repair permissions.
Restarted the computer.
Tried different combinations of Code Signing.
Delete App from device.
Searched through project for any duplicate file names.
Here is the warning verbatim:
Warning: Multiple build commands for output file /Users/jinser/Library/Developer/Xcode/DerivedData/Landmarks-bgnzcomxftpffiezmwocaqdydrlj/Build/Products/Debug-iphoneos/Landmarks.app/Landmarks
and here is the error:
GenerateDSYMFile /Users/jinser/Library/Developer/Xcode/DerivedData/Landmarks-bgnzcomxftpffiezmwocaqdydrlj/Build/Products/Debug-iphoneos/Landmarks.app.dSYM /Users/jinser/Library/Developer/Xcode/DerivedData/Landmarks-bgnzcomxftpffiezmwocaqdydrlj/Build/Products/Debug-iphoneos/Landmarks.app/Landmarks
cd "/Users/jinser/Desktop/Kevin/Cocos2D Projects/ARSpaceships"
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/usr/bin/dsymutil /Users/jinser/Library/Developer/Xcode/DerivedData/Landmarks-bgnzcomxftpffiezmwocaqdydrlj/Build/Products/Debug-iphoneos/Landmarks.app/Landmarks -o /Users/jinser/Library/Developer/Xcode/DerivedData/Landmarks-bgnzcomxftpffiezmwocaqdydrlj/Build/Products/Debug-iphoneos/Landmarks.app.dSYM
error: unable to open executable ''
This is Xcode 4.2 on Mac 10.6.8. Please, any advice would be appreciated. I am losing my mind.
Thanks.
So to whoever runs into this problem and all of the other solutions out there do not work for you, make sure you don't have a project folder that shares the same name as the project. For instance, my project is called Landmarks and I had a folder inside the resources also called Landmarks. Once I renamed the folder, all was well.
Not my answer, but LargeGlasses provided the real answer (for me) in a comment, I've formulated it as an answer in its own right because I can't Up Vote the comment.
any two files within your project that have the same name will cause this warning.
In my case, I had an icon with the same name in different subfolders, one was used by the App and the other was part of my help resource located in a different folder. The solution is to just rename one of the two.
All credit and my thanks for this answer to LargeGlasses.

How to run phone gap with xcode4?

Since moving to XCode4, I have been getting errors like:
/VERSION: No such file or directory
cp: /javascripts/phonegap..js: No such file or directory
cp: /javascripts/phonegap..min.js: No such file or directory
error: /VERSION: No such file or directory
for projects that were working under XCode3.
Open XCodes Preferences, and navigate to Source Trees. If there is no PhoneGapLib entry there, try adding a new setting with the following values:
Setting Name: PHONEGAPLIB
Display Name: Phone Gap Lib
Path: /Users//Documents/PhoneGapLib
Note that the path should be to the location of your PhoneGapLib folder, and that it may not be in your documents folder, depending on how you installed PhoneGap.
I just learned about a great web service recently made available by Nitobi (makes of PG), which will automatically generate the necessary PhoneGap files you need for use in Xcode 4.
Just enter your project name, hit a button and they'll generate a zip file for you to download. This lets you set up a new project without messing with the command line.
You could set up a new project, then migrate your older project files over.
Did you search Google for this error?
I'm a bit of a noob with PhoneGap and Xcode still, but I know there have been recent issues with PG and Xcode 4. Perhaps you're experiencing the same issues as the commenters to this post: PhoneGap + XCode4 (and more specifically, here).

CorePlot: how to run on device? (works OK on simulator)

My app uses CorePlot and runs fine on simulator
(it accesses libCorePlot-CocoaTouch.a from:
/Users/myName/core-plot/build/Debug-iphonesimulator ).
To run on device, xcode expects libCorePlot-CocoaTouch.a in:
/Users/myName/core-plot/build/Debug-iphoneos
but that file is missing, so xcode gives error:
'/Users/Giovanni/core-plot/build/Debug-iphoneos/libCorePlot-CocoaTouch.a: No such file or directory'
I tried generating one by doing:
CorePlot-CocoaTouch.proj > set Xcode to build on 'device' > 'Build And Run'
but 'Build and Run' is grayed out.
Copying the simulator version obviously does not work.
Any ideas?
Consider adding CorePlot-CocoaTouch.xcodeproj as a sub-project and then add libCorePlot-CocoaTouch as a dependency.
Try opening the Core Plot project itself and building the framework first. You should build (not "Build and Run") the CorePlot-CocoaTouch target. Do it for each combination of SDK {simulator, device} and configuration {debug, release} (total of four builds). This will create the .a files you need.
After Core Plot is built, go back to your project and build it. It should now link and run correctly.
Check out my answer here if you don't want to use the CorePlot-CocoaTouch.xcodeproj import method (don't need to import the whole project, only the CorePlotHeader folder and the libCorePlot-CocoaTouch.a library file) Fix linker errors for Core Plot when using Xcode 5
Ultimately you might need to delete the old library by right clicking on your MyApp.app file in the Products folder and copy and past the new CorePlot_1.4 .a file into the Debug-iphoneos folder...clean, build, and it should run on an iOS 7 device.
SOLUTION: the issue was CorePlot-CocoaTouch.xcodeproj must also be added as Targets>MyApp>getInfo>DIRECT dependency (in addition to as subproject and in addition to libCorePlot-CocoaTouch being added as Targets>MyApp>getInfo>LinkedLibraries). Thanks

How to Manually Symbolicate iOS Crash to View Crash Logs

Trying to debug app. The trouble is I cannot find this program.
symbolicatecrash.sh
sudo cp /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneRemoteDevice.xcodeplugin/Contents/Resources/symbolicatecrash /usr/local/bin/
Is it a separate download? I am using XCode 3.2.3
Thanks.
EDIT :: XCode 4.3
You will want to follow the same steps as outlined in the original answer (below) with a few exceptions.
First, you need to fix the Xcode path. Open a terminal and run:
/usr/bin/xcode-select -print-path
If it displays "/Developer" or anything but "/Applications/Xcode.app/Contents/Developer/" then it is wrong. To fix this run the command:
sudo /usr/bin/xcode-select -switch
/Applications/Xcode.app/Contents/Developer/
You can now run all the steps below, with the exception that the symbolicatecrash command is in a new spot (again). This is because Xcode now installs as an app. To find symbolicatecrash run this from the terminal:
find /Applications/Xcode.app -name symbolicatecrash -type f
This should return:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash
Before running symbolicatecrash you may wish to go to this directory like:
cd
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/
Original Answer :: Xcode < 4.3
Path for symbolicatecrash
Search from a terminal using:
find /Developer -name symbolicatecrash -type f
For me this returned:
/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash
How to Manually Symbolicate a Crash Log
Run the symbolicatecrash command with the crash log as the first argument and your dSYM file as your second argument. Note that if you will be running symbolicatecrash from the current directory that you MUST put ./ in front like ./symbolicatecrash unless your PATH environment variable includes the directory that the command resides in.
I changed to the directory that had the symbolicatecrash command in it first (note: will be different for Xcode 4.3, see top):
cd
/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/
Then I executed the following command:
./symbolicatecrash /somePath/MyCrashLogFile.crash
/somePath/MyAppName.app.dSYM
How to Find the dSYM file:
You must have the archive that was used to create the build with the crash to get the dSYM file.
Here are the steps:
Right click (or ctrl click) the archive from organizer and choose "Show in Finder".
From the xcarchive file in finder, right click (or ctrl click) this file and choose "Show Package Contents". You will then see a "dSYMs" folder.
Inside the "dSYMs" folder you will find "YourAppName.app.dSYM" file that you will need to symbolicate files.
A plugin is available for Xcode under the Product menu. This plugin is available through Alcatraz package manager or can be directly downloaded from github.
This plugin internally incorporates a shell script that does the set up of running the following commands for manual crash symbolication.
Set an alias to symbolicatecrash.pl perl script
alias
symbolicatecrash='/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash'
To find symbolicatecrash, should it differ from the alias above:
find /Applications/Xcode.app -name symbolicatecrash -type f
Set the DEVELOPER_DIR variable:
export DEVELOPER_DIR='/Applications/Xcode.app/Contents/Developer'
With the dSYM the crash can be symbolicates as:
symbolicatecrash /path/to/MyApp_2012-10-01_Device.crash
/path/to/MyApp.app.dSYM.
One way to symbolicate a crash log is to run the following command on terminal:
xcrun atos -o MyApp.app/MyApp -arch armv7 -l 0xb7000 -f MyApp.crash
Replace the example hexadecimal number(0xb700) in the command above with the base load address. Base load address is the first memory address in the line immediately after
"Binary Images:"
To get the .app file:
Right click on the xcarchive file and select Show Package Contents
The .app file is in the Products/Applications directory.
I just wrote a post on debugging crash log 5 min ago here: http://just2us.com/2010/10/reading-iphone-crashlog/
You might not need symbolicatecrash.sh anymore if drag and drop the logs to Xcode is good enough for your purpose. I am using 3.2.4, and I can't find the script too.
As Apple explains, Xcode will try to symbolicate automatically. It uses symbolicatecrash and spotlight to do that. However if the app wasn't built locally or it was deleted, then the necessary .app and .dsym files are not available.
So keep around the dsym file and the app of released versions. Build tools will often zip the .dsym file to a .dsym.zip and package the .app as an .ipa. You can unzip both and copy .app and .dsym to the same folder. Then Xcode will be able to find them using spotlight.
Here is a simple method I use:
Open Xcode 6
Plug in your dev device
Within Xcode, go to Window > Devices > Select your device
Press 'View Device Logs'
Drag your report into the window to view it