Where is the iconset command-line tool 'iconutil' located? - command-line

I have XCode 4.2 and need to submit a Mac app to App Store. I've tried all kinds of suggested methods to get the multi-resolution icons in there, so you don't need to inform me on that.
The remaining method is to use iconutil. I've searched in Spotlight, searched my Mac's harddisk in Finder, two later XCode .dmg images, sudo find in Terminal, and looked for paths on the web. The XCode 4.4.1 .dmg had Iconutil.strings and Iconutil.xcspecs, but that's as far as I've come.
Is there a package I can download to get this command or tool, so I can convert the .iconset? If there is a setting I can change in XCode to make it allow the old .icns files (before 1024x1024 and 512x512#2x), that would be a solution that I could accept temporarily. I have OS 10.6.8.
EDIT
I would accept an answer that confirms whether the command is there in 10.6.8 and where it is. I would accept an answer that links to a valid .icns file with 512x512 and 512x512#2x (preferably uncompressed .png inside) that has been approved by App Store validation recently.

I have Xcode 4.5. There you must install the command-line tools separately.
Check Xcode Preferences --> Downloads --> Components. There you should find "Command Line Tools" and a download button where you can install these tools.
Then you can proceed as shown in the OS X documentation: Optimizing for High Resolution, Provide High-Resolution Versions of All App Graphics Resources.
I hope this will help you.

You first need to ensure you have xcode-select (manpage) set-up correctly; this will show you the current setting:
$ xcode-select -print-path
This needs to point to the /.../Xcode.app/Contents/Developer folder, so if you had Xcode.app installed in /Applications you can change that using:
$ xcode-select -switch /Applications/Xcode.app/Contents/Developer
Now if iconutil is packaged with Xcode (I cannot check at the moment), you should be able to run it with xcrun (manpage):
$ xcrun iconutil ...whatever...

I have both Xcode 4.2 and Xcode 3.2.5 installed on Snow Leopard and iconutil is not in the system.

Related

Jailbreak development using xcode

I have been looking around for learning how xcode can be used for jailbreak development.
I have Lion and jailbroken iPhone3G and xcode4.6 which doesnt support iPhone3G.
I have installed ldid but have no idea how to use it.
I have to make launch daemons, too, and attach them with my application. I have followed this tutorial for making a daemon but i got stuck in the setup for creating an open tool chain template in xcode. I followed every step but my xcode is not showing any template for open tool chain. Is it really required to have open tool chain template?
You're right. Xcode 4.6 doesn't support the iPhone 3G. Can you install an older version of Xcode? For example, Xcode 4.4 still supports the 3G.
Login to the Apple Developer Portal and download old versions here
You can choose to install the old version of Xcode in a different folder, so that it doesn't overwrite the new version (for example, install to /Developer-old/ or something).
Once you install the old Xcode version, you can navigate to the installation directory and look for the directory named:
iPhoneOS5.0.sdk
(or probably iPhoneOS5.1.sdk would work, too). Then, copy that entire folder into the new Xcode 4.6 installation directory. For example:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
Afterwards, you should see this:
iPhoneOS5.0.sdk
iPhoneOS6.1.sdk
With the 5.0 SDK installed, you can now build apps for the iPhone 3G, using Xcode 4.6. You can also now uninstall Xcode 4.4 if you want. See more about this in this other question. The key is that you will be building your app for armv6 (only). Armv6 is the iPhone 3G's processor.
The second step is to turn off code-signing within Xcode. In your project settings, you set the provisioning profile to Don't Code Sign. You must modify an Xcode configuration file to allow you to do this.
Now you build the app in Xcode. When you're done, navigate to the directory on your Mac where the app has been built (where the MyAppName.app/ folder is). Then, you use ldid to fake code sign the app executable:
ldid -S MyAppName.app/MyAppName
Now, your app has a fake code signature that will allow it to run on a jailbroken phone.
Then, you use ssh, or scp, or something else to transfer it to your phone, where it should be installed under /Applications/.
You already have the best link on building iOS Launch Daemons. I'd stick with that tutorial. No, I don't have any open toolchain template in Xcode, either. I just use Chris' tutorial to see how to build a non-graphical daemon main program (not a UIApplication), copy it to my MyAppName.app folder, and create a com.mycompany.mydaemon.plist file that defines the Launch Daemon.
Once the plist is installed in /System/Library/LaunchDaemons/ on the phone, you can start it, without having to reboot the phone, with:
launchctl load -w /System/Library/LaunchDaemons/com.mycompany.mydaemon.plist
at the command line (on the phone). Or, just reboot the phone, and the daemon will start automatically.
Although I learned to do this before it was available, you can now look at iOSOpenDev if you'd like a more polished way of doing some of this stuff.
Yes. Xcode can be used for developing jailbreak-type projects. Use iOSOpenDev to set up Xcode and iOS SDK to allow jailbreak-type development.
iOSOpenDev comes with a set of templates, signs (with ldid) targets and creates Debian packages (packages are submitted to repos like ModMyI and BigBoss) during its build phase, in addition to installing packages directly to an iDevice with Cmd-Shift-I (build for profiling shortcut) for immediate testing, among other useful features for using Xcode to develop jailbreak-type projects.

Is it possible to get the iOS 6.1 SDK for Xcode 4.2 on Snow Leopard?

I know this worked with ios 6.0 following these steps Is it possible to get the iOS 5.1 SDK for Xcode 4.2 on Snow Leopard? but it doesnt appear this is possible now. Does anyone know a workaround or should i just upgrade?
Still possible. In fact, you can do all the development and submit applications to Appstore using XCode 4.2 on Snow Leopard with SDK 6.1. However, you can't run simulator 6.1 (so use a real device).
Here is how (a few steps abbreviated):
You will need to find a system with Lion/Mountain Lion and XCode 4.5, which you will use as a source of data (I have one in VMWare). IMPORTANT: You will need to connect an iOS device running ios 6.1 to that system and open it in XCode 4.5 organizer, so that XCode can download appropriate symbols.
From system with XCode 4.5 copy the following source directories:
Device Support: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/6.1 (10B141)
SDK: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk
It may be most convenient to archive each directory using tar, like so:
tar cvf /tmp/archive.tar << name of your directory >>
NOTE: specific version of Device Support directory may differ, (i.e. "6.1.2 (10B146)" or higher), use the one matching your ios device in all following instructions.
You will need to copy these directories to the Snow Leopard system with XCode 4.2 into the following directories (assuming your XCode installation is in /Developer. If, like mine, it's somewhere else, replace first component of the path as needed):
Device Support: /Developer/Platforms/iPhoneOS.platform/DeviceSupport/
SDK: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs
If using tar, change into each directory and extract its respective tar archive like so:
tar xvf /tmp/archive.tar . Using tar has an advantage of preserving timestamps, symbolink links etc, if there are any.
After copying, remove link "Latest" in Device Support directory and re-link to "6.1 (10B141)" like so: ln -s "6.1 (10B141)" Latest
==============================================
At this point you can restart XCode 4.2 and you should be able to:
Add your 6.1 device in organizer, and run and debug code on it
Select 6.1 SDK as "latest" for your projects and build against it.
==============================================
However, if you are trying to support a 4" iPhone 5 screen (by adding Default-568h#2x.png startup image) you still can't quite submit an application built that way to the Appstore. XCode 4.2 embeds SDK 5.0 into some of the metadata in the application archive, so it looks like the application is built against 5.0 sdk. Appstore actively refuses binaries that include 4" screen support and are not built against 6.0 or higher SDK.
So, you must resort to some manual work to tell Appstore what is already true :)
Here is how:
Archive your application. Open archive directory in finder (right click on the line, "reveal in finder"), open Terminal, type "cd ", drag and drop the directory to Terminal and press "Enter". Now you are in that directory and can work with files there.
cd Products/Applications/yourapp.app
There will be a file called Info.plist - it's in a binary form. Convert it to XML like so:
plutil -convert xml1 Info.plist
Open Info.plist in your favorite editor. Find references to sdk 5.0 (or binary value of SDK) in the following entries and replace with references to 6.1:
DTPlatformVersion: 6.1
DTPlatformBuild: 10B141
DTSDKBuild: 10B141
DTSDKName: iphoneos6.1
If you feel adventurous, replace XCode version and build values too. I did not.
plutil -convert binary1 Info.plist
Now you need to re-sign the application. Application binary is in the same folder, should be named "yourapp"
To do so, you will first need a copy of embedded entitlements file that is to be used during signing.
You can either copy that file from an application archive made under XCode 4.5: look for file name: archived-expanded-entitlements.xcent , copy to the application directory (just in case, not sure if needed)
extract it from current application like so:
codesign -d --entitlements /tmp/entitlements.xml "yourapp"
Open file /tmp/entitlements.txt in text editor and clean up any weird stuff that goes before < ?xml version tag, save.
Now find the exact name of your distribution certificate. You can copy it from a number of places, but the best is to open Keychain Access app, select the distribution certificate, doube-click to open properties and copy "common name". It should be something like "iPhone Distribution: your company"
Still in the archive directory, run codesign as follows:
First remove current signature file just in case:
rm -rf _CodeSignature
Then run:
codesign -f -s "iPhone Distribution: your company" --entitlements /tmp/entitlements.xml yourapp
This is it. Your application is now built against 6.1 SDK and shows as such. You should be able to validate and submit it to appstore from Organizer.
============================
Disclaimer: my app submitted this way is still "Waiting for Review". Will post here if it is accepted/rejected because of this.
Note: so why jump through these hoops? Well, a few reasons:
Because I should be able to develop in whatever environment I want, dammit.
XCode 4.2 on OSX 10.6 is the last version of XCode that supports PowerPC and OSX 10.4 SDK. If, like me, you have to support an old desktop product that must run on that platform - you have no choice, but to stick with it until last PowerPC user drops his device. These guys are old and tenacious. Using two machines for development is not an attractive option for me.

iOS simulator only list the latest iOS version. How can I set earlier versions

According to the documentation should be able to choose which iOS version the simulator should run, however only the latest 4.3.2 is listed under "Hardware/Version".
The helps says:
"To set the iOS release used in the simulation environment, choose Hardware > Version, and choose the version you want to test on."
I don't want to support 3.x (although it would be nice) but at least I want to simulate my app on 4.2, 4.1 and 4.0.
What's going on? Why aren't they listed?
UPDATE:
I'm on Lion so I cannot install an earlier version of Xcode. Before my Upgrade I could test different versions easily.
the problem is that you have no other Simulator SDK installed which can be used. As #dorada has mentioned you have to install an older Xcode which in fact doesn't work because you're using Lion. I haven't tried it with Lion but principally it should work like before with Snow Leopard.
I'm referencing to my other answer how to get an older Xcode (don't know if it's still working)
After you have an older Xcode version, mount the image an navigate with terminal to that volume. There should be a hidden folder Packages. open that folder with open . and locate the two .pkg files you need (e.g. iPhoneSDK4_0.pkg and iPhoneSimulatorSDK4_0.pkg) and install both.
They will appear in your root directory and you have to move them to your Developer dir (don't simply overwrite, it will delete all other SDKs. go to the last different folder it should be iPhoneSimulator4.0.sdk\ and copy that one)
DONE (and at that point I have verified it: it works on my Lion. I used the dvd image which I have started backup'ing since 3.2.1)
Although iPortable has the correct answer I decided to post a step-by-step guide which is easer to follow:
Download Xcode 3.1
Mount the dmg file
In Finder menu select "Go\Go to folder" and enter "/Volumes/Xcode and iOS SDK/Packages"
Install the simulators you need (Double click)
Copy the simulation folders from /Platforms/iPhoneSimulator.platform/Developer/SDKs/ to /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
If your have some SDK missing Install the missing SDK from "/Volumes/Xcode and iOS SDK/Packages" and copy subfolders from /Platforms/iPhoneOS.platform/DeviceSupport/ to /Developer/Platforms/iPhoneOS.platform/DeviceSupport/ (for me they were all there from 3.1 to 4.3)
you may download the older ios sdk / xcode from . https://developer.apple.com/downloads/index.action
(i found this answer in another stack overflow topic actually, but now i can not seem to find that question!)
Open Xcode and in the menu at the top left, where you select what device to run on, click "More Simulators..."
The download section of Xcode preferences will open,
Click the "Components" tab.
You will see a list of simulators that can be installed, click install on version you need.
The simulator will need to restart to install.
To run the newly installed version of the simulator just select it from the run menu in Xcode.
You actually have to install previous simulator versions, they aren't there on a new install.
Maybe you can search and download them somewhere? - we keep them on a shared drive at the office.
After installing the Xcode 4.2 for Snow Leopard, I noticed there was a choice for iPad 3.2 Simulator, but using it just brings up some alerts that say "iOS Simulator could not find the SDK. The SDK may need to be reinstalled." and another alert that says "Simulated application quit. Click Relaunch to try again." with Quit, Switch SDK, and Relaunch buttons.
I can successfully use iPhone 4.0 Simulator, iPhone 4.1 Simulator, iPad 4.2 Simulator, etc up to iPad/iPhone 5.0 Simulator, but really would like to have iPad 3.2 Simulator and iPhone 3.1.3 Simulator and earlier down to 3.0 if possible.
Our apps generally run all the way back to 3.0 and we occasionally receive bug reports from earlier iOS users, and would love to be able to debug these issues more effectively.
I tried the technique summarized by Tibidabo and although I am able to copy the simulator folders as mentioned, and though they show up as choices in Xcode, I cannot get them to actually run as simulators and I get the same problem alerts mentioned above.
What are other developers doing to support debugging of older iOS versions?
Go to Project Settings -> Summary an change Deployment Target.

Can't build a new project with xcode on my MacPro

I've installed on my MacPro (intel) Xcode 3.2.1 (iPhone SDK 3.1.2) and Snow Leopard
I made a new project (called Untitled) for iPhone OS, when I try to build, it returns an error:
*file not found:
*/Users/user/Documents/Untitled/build/Untitled.build/Debug-iphonesimulator/Untitled.build/Objects-normal/i386/main.o
*/Users/user/Documents/Untitled/build/Untitled.build/Debug-iphonesimulator/Untitled.build/Objects-normal/i386/UntitledAppDelegate.o*
*Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1*
and doesn't go over!!
what i've to do to fix?
thank you for your answers
"Untitled" is a common place holder so it's possible that the using that as the project name has caused a problem with one of the build scripts. Try another project with a more unique name.
Other possible problems: (1) Permissions problem with the build directories (2) if you messed with the build settings you might have switched off the creation of the executable.
Edit01:
(Response to comment)
It sounds like you have a nasty corruption problem for some reason. Some things to try.
(1) Create a new user and try to run Xcode from that account. That will tell you if the problem is with the developer install or if its some kind of preferences or other file in the user's home directory. Xcode and the other dev apps dynamically create a lot of directories and files that an reinstall will not affect.
(2) You can do a complete uninstall of the developer tools from the command line.
sudo /Developer/Library/uninstall-devtools --mode=all
(3) Xcode is just a face application for a full suit of unix command line development tools. If you installed different versions of these tool e.g. gcc, gdb etc, you might have altered something critical.
(4) Xcode plug-ins can cause problems. Make sure you remove all of them.
I had a crash in Xcode once, and afterwards I could never get Xcode to run under that user account. I spent nearly two days trying to troubleshoot before giving up and moving to another account. That turned out to be a good thing because it allowed me to create an account focused solely on development without all the distractions of my normal account.
Doesn't Xcode 3.2 (not 3.1.2) ship with Snow Leopard? If you're using Snow Leopard, you should be using the appropriate version of Xcode for Snow Leopard, which is the 3.2 series.

The version of iPhone OS on “” does not match any of the versions of iPhone OS supported for development with this copy of Xcode

I have followed Apples tutorial and upgraded my iphone to 3.0. But i get this error:
OS Installed on
3.0 (7A341)
Xcode Supported iPhone OS Versions
3.0 (7A312g)
2.2.1
And when i try to run an application on my iphone xcode states:
No provisioned iPhone OS device is connected.
What have I missed?
Stumbled across this question because I've had the same problem with 3.0.1. Apple has an advisory (PDF) about how to get XCode to stop worrying and love the 3.0.1. It boils down to running a command in Terminal:
ln -s /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0\ \(7A341\) /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0.1
It looks like you need to upgrade xcode to the newest version of the SDK as well as your iPhone / iPod Touch to the newest version of the SDK. It looks like your XCode is from beta 5 where your iPhone is GM.
Both XCode and the iPhone OS need to be the most recent version to install apps. In addition, you will need to reenable the iPhone for development after every software upgrade in the XCode device manager.
Look in the organizer window if the phone is in orange state ..then just restart the phone and see.
How To:
Add an iOS SDK from a downloaded Xcode dmg:
Download the Xcode version dmg containing the iOS SDK you need
Make sure Xcode is not running
Double click the downloaded Xcode dmg, right click the Xcode.app icon, choose "Show Package Content"
Copy Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ to /Developer/Platforms/iPhoneOS.platform/Developer/SDKs (on you local machine)
Copy Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/ to /Developer/Platforms/iPhoneSimulator.platform/Developer (on you local machine)
Copy Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/ to /Developer/Platforms/iPhoneOS.platform/DeviceSupport (on you local machine)
Right click Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/, choose "Make Alias", rename the alias to "Latest"
Start Xcode
I have solved this as Pluckyglen said, but will add that this is a way to cheat XCode about the version of the Device.
Creating a unix Symbolic link:
ln -s <´Xcode version´> <´Device Version´>
makes Xcode think that the device version is a supported version, cause we are making the dev version just a link to one of the supported versions.
At least this is what I understood :P