Adding an external executable in Xcode 4 - xcode

I would like to debug Firefox code on OS X.
I'm reading from this page and it tells me:
Now you need to add the executable. Select Project > New Custom
Executable and type a pretty name, then click the Choose button to
locate the .app file that you want to debug (Mozilla.app, Firefox.app,
DeerParkDebug.app etc). The .app file is
But with xcode 4 there is no Projects menu. I can't seem to find out how to add a custom executable. I have successfully built Firefox but I just can't debug it because I don't know how to add an executable in Xcode 4. I suspect the steps in the link were for Xcode 3.

Under Xcode 4 you will have to edit a scheme to run an executable. Select a scheme (or duplicate one for your target) then select the "Run" phase. You will see an "Executable" pop-up menu, select which executable you wish to use then run your target. There are other settings for specifying the arguments, etc just as in Xcode 3.

Related

how to find xcode 7.2 .app file location on the mac

I have project in Xcode 7.2 and i need .app file it generates to be able to point it to monkey talk scripts to run test.
i could not find any options to see it.
i was looking in ~/Library/ locations etc.
but no results. is there a way to find build location etc in the Xcode 7.2
The monkey talk target only accepts the .app file
or if there is a way to run mt scripts directly from the installed location on simulator that will help too.
In Xcode if you click on Window -> Organizer you will se a list of build archives. You can right click on then (if there is any of course) and click on Show in Finder. That will be the location of the .xcarchive that contains inside it the dsyms, plists and the .app which I suppose is what you are looking for. In order to archive a build you have to click on Product -> Archive. I hope that helps.
The full path on my machine is /Library/Developer/Xcode/Archives/<#date#>/<#project#>.xcarchive/Products/Application/<#Application#>.app

Debugging Quicklook Plugin in Xcode

I am trying to debug a quicklook plugin in Xcode 4.6. I have created the executable in Edit Scheme.
Now, when I build the project the plugin is not installed to the "/Library/Quicklook" path.
Rather I didn't find it anywhere.
I want to run the plugin in debug mode and want to hit the breakpoints so that I can figure out where the plugin crashes on different files.
You can use brake points and NSLog function for debugging QL plugin. But first you need to configure environment.
Select your project on Project Navigator
Then select QL plugin target
Go to 'Build Phases' tab and add new phase 'Copy files'
Select 'Absolute Path' on destination drop down menu and set ~/Library/QuickLook as subpath
Open terminal and copy qlmanage to your project's root directory with command cp /usr/bin/qlmanage PROJECT_ROOT_DIR
Then select menu Product -> Scheme -> Edit Scheme...
Select 'Run' on schemes list
On info tab select executable drop down menu, then 'Other...' and select qlmanage binary you have copied to project's root directory
On arguments tab add row for 'Arguments Passed On Launch' and set value to -p FULL_PATH_TO_FILE_FOR_PREVIEW
After all steps you can run your project and debug your code.
Xcode 6 must be different somehow, because the instructions above didn't work for me. But here's a solution that I puzzled out today and that works. Hopefuly it will help someone else.
(Assume the name of your plugin is myplugin.qlgenerator)
First of all, if you tried the earlier solutions above, undo them.
Delete the Copy Phase that copies your binary to ~/Library/Quicklook and delete the copy of qlmanage you may have copied to your project's root.
Set the Executable to /usr/bin/qlmanage. "qlmanage" is the program that will load and run your plugin.
Edit your scheme.
Choose 'Run' from the list on the left, then the Info tab of the display on the right.
Choose 'Other...' from the Executable popup. A standard file sheet will appear.
Type cmd-shift-g. A 'Go to folder' sheet appears with a text field.
Enter /usr/bin/ and hit the Go button. The standard file sheet should now be showing the contents of /usr/bin.
Select the 'qlmanage' binary
Turn on the 'Debug executable' checkbox and click the Choose button.
Configure the Arguments Xcode passes to qlmanage
Select the Arguments tab in the Run section of the Edit Schemes sheet.
Remove any arguments that may be left over from previous attempts.
Add -c public.data as the first argument to be passed on launch. You may need to change this depending on the kind of UTIs your plugin supports.
Add -g $(BUILD_DIR)/Debug/myplugin.qlgenerator as the second argument. This resolves to a path to the debug version of your plugin.
Add -p '/fullpath/to/file/to/be/quicklooked as the third argument. This is a path to a file that should already exist. Your plugin will be asked to render previews of this file.
Close the Schemes sheet.
That's it. You should now be able to debug your pluging including setting (and hitting) breakpoints!
I've written this blog post describing how to debug Quick Look plugins which should work as of Xcode 8.2 / macOS 10.12.
Giving due credit, this is basically the steps given here by mlist0987 but with an extra step to get around the System Integrity Protection introduced in 10.11.
TLDR: you have to take a copy of the version of qlmanage, referenced by the link in /usr/bin (i.e. don't just copy the alias) and set that as the debugging executable.

How to make an IPA on XCode 4.3?

I have a Mac OS X Lion setup with XCode 4.3. I am not a registered Apple developer.
I told, via the plist files: /Applications/Xcode.App/Contents/Developer/Platforms/iPhoneOS.platform/Info.plist and
/Applications/Xcode.App/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/SDKSettings.plist, XCode not to require codesigning.
I then compiled my project, just a basic iPhone app project, it ran well in simulator. I could build and archive it, then sign it using a self-created certificate and the archive appeared in the Organizer.
Nothing strange for the moment, but there comes the problem: I have no "Share" button in the organizer. I absolutely need to make an IPA file out of my project if I want it to work under an iPhone as it won't accept xcarchive files. I only get the "Validate" and "Distribute" buttons which both require to be a registered Apple developer. But, no "Share" button which enables building an IPA... for free.
I have gone through XCode settings but nothing seemed to help me there. Even the documentation says a Share button is available in XCode 4.3, so my question is: Why don't I get the possibility to make an IPA? IS there any workaround to get this Share button or make an IPA out of the xcarchive via any command line or whatever?
Here's how you can make an IPA in XCode 4.3:
To Disable Code Signing:
Go to /Applications.
Right click on XCode and select 'Show Package Contents'.
Copy Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/SDKSettings.plist to your desktop. (Make sure to actually copy and paste. No drag and drop)
Open it and under DefaultProperties set CODE_SIGNING_REQUIRED to NO.
Copy it back and replace the original file.
Restart XCode.
Open your project.
In Project Navigator select your project and open Build Settings section of your porject (and not any particular target)
Under Code Signing find Code Signing Identity and for both Debug and Release modes set Any iOS SKD to Don't Code Sign.
Now you should be able to build your project without any errors.
To make an IPA:
In 'Project Navigator' select Products
Right click on [NameOfYourProject].app and select 'Show in Finder'.
Create a folder and name it Payload
Move [NameOfYourProject].app to Payload.
Compress Payload and rename it to [NameOfYourProject].ipa
You should be able to get an IPA by clicking 'Distribute...' in Organizer->Archives, and choosing to 'Save for Enterprise or Ad-Hoc Deployment'.
Beginning iOs 5.1 Apple moved their files from /Developer/... to XCode->Show Package Content
In order to export codesign_allocate correctly run this line on your Mac terminal :
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate

How to get .app file of a xcode application

I have created an xcode project. Now I want to give .app file to my friend to use that application. From where do I get this file? How to install this .app file in his Applications folder using an installer package?
You can find the .app file here:
~/Library/Developer/Xcode/DerivedData/{app name}/Build/Products/Deployment/
Credit for the path location goes to this answer
SIDENOTE: I had a lot of fun trying to get this into my iPad after that. It worked however. Using Snow Leopard + Xcode 4.2 + iPad with IOS 5.1.1 :) - I used the iPhone configuration utility to get the app into the ipad (you have to add the app, then click on the device, then click "install" behind the app you just added in the "application library" of iphone configuration utility) and had to create a Distribution Provisioning Profile and get the WWDR certificate and finally change the build settings in Xcode after all the certificates were in place. See here
But after much fun I am now looking at my first app on my iPad :) - btw, for getting apps into the app store you need to create a app store Distribution Provisioning Profile, while for ad hoc installs like these you create an ad hoc one. There is a bit more to it, but I think these are the most important and tricky steps. Enjoy.
PS. Just remembered that you also have to set the build type (top left of Xcode) to "iOS device", otherwise it will never sign your application. So the path name above only has limited value: yes, it will have the .app file in it, but no you can't upload it (at least not using the iPhone configuration utility) since it is not code signed - you will get an "Could not copy validate signature" error. So change it to "iOS device" and build (remember to select the right certificates in the build section of Xcode as per the url info above). In that same build section, you can also set the "Installation Build Products Location" to a different path, so that you can determine where the .app (the one that is properly code signed) ends up.
Xcode 12.5
Can be found in the following directory ->
~/Library/Developer/Xcode/DerivedData/{app name}/Build/Products/{scheme}-iphonesimulator/{app name}.app
Build a release version, and the .app file is under build/Release folder of your project. Just copy it to Applications folder of your friend's machine. I don't think you need to build a installer.
xCode window tab
Organizer
Right click to the archive you want to get app
Show in finder
Right click to (ProductName….). xcarchive file
Show package contents
Products
Applications
Finally - THERE IS YOUR .APP PROJECT FILE !
The application will appear in your projects Build directory. In the source pane on the left of the Xcode window you should see a section called 'Products'. Listed under there will be your application name. If you right-click on this you can select 'Reveal in Finder' to be taken to the application in the Finder. You can send this to your friend directly and he can just copy it into his Applications folder. Most applications do not require an installer package on Mac OS X.
Under Xcode 4.5.2, you can find the .app file in this way:
Select Window > Organizer in the Xcode's menu(or just press 'Shift+Command+2')
Select your project on the left side of Organizer, and you will find the Derived Data path on the right side. Just click the mini arrow in the end of the path, this will open Finder at the path.
In the Finder, click "Build > Products > Release", you will find the .app.
I know as for Appium Mobile Automation you need .app file to run ios app on Simulator.So as like me many of you face this problem.
So I explain how to create that .app file and where it is located.
1.Open Xcode.
2.Click on your sample project.(If you don't have then click on create new xcode project)
3.In left panel inside screen you will see products folder then click and expand that, you will see the list.
Then right click on .app file and click on Show in Finder and thats your .app file. Now you can copy or use that path in capabilities for appium desktop or in framework.
Xcode 8.1
Product -> Archive
Then export on the right hand side to somewhere on your drive.
In Xcode 7 a quick way is to use Product > Archive. It's probably not a signed copy for submission but it's good enough to give to somebody else for testing.
In the navigator (left pane), expand the group "Products" and right-click on the .app file and choose "Show in Finder". There it is! :)

How to start Xcode debugger for a project without any executable?

I have a Xcode project that is building a library and I want to be able to debug the library when it is loaded by the main application.
Run and Debug options from Run menu are disabled and if i try to use attach to process option I get "No launchable executable present at path". When looking at Active Executable I see but I don't know how to tell xcode what to run/debug.
So how should I debug the application? I'm looking for something similar to the project configuration of Visual Studio but I wasn't able to locate this option yet.
Add a custom executable to your project.
It is under the Project -> New Custom Executable... menu item.
From there, you can add your application as the custom executable and that will give you the ability to debug the application and the plug-in.
One additional helpful hint; in Xcode's build preferences set up a single common products directory. This will put the symbol files for building your application in the same directory as your application (assuming your main application is one you build) and, thus, you'll be able to step through frames in both your library and your application.
For those using Xcode 4:
Project > Scheme > Edit Scheme...
Select the Run phase > Info
And set an Executable

Resources