Command line ios app upload with Xcode 6 - iphone

We have been using the answer provided here (How to upload an iOS app to the app store via command line) by Tomer Shiri to automate the uploading of our apps to the iTunes Connect using a script. This has been worked fine with Xcode 5.X but now we have installed Xcode 6 this fails when run.
We believe the script we have made is falling over on the line that contains the xcrun command with the error of:
users-mac-mini:~ user$ sh /Users/user/Desktop/Master\ Upload\ Script.sh
sh: create.sh: No such file or directory
error: Unknown application extension '.' - expected '.app' or '.ipa'
Does anyone know if the xcrun command has changed in Xcode 6? and if so what would be the equivalent command that incorporates any changes?
Thanks
James
EDIT: as a side thought I have seen a few comments around the internet that suggest that apple has confirmed that this is an undocumented tool. With that in mind, is anyone with decompiling\ disassembly skills able and willing to pull this apart and find a list of the CLI options for the xcode 6 version of the xcrun binary?

Related

Socket Rocket Test/Tutorial

I'm new to socketrocket and to iOS development. I'm trying to follow along at https://github.com/square/SocketRocket#readme and implement the basic test chat app but am having trouble making things work.
Beginning with "go into the SocketRocket root directory and type: make test" i need some help.
Using the mac terminal, 'make' isn't a recognized command. Do i need to have python enabled on my mac for this to work at all? Trying to run the testapp in xcode before the server is started does nothing.
A more bare bones explanation would be most appreciated
You need to install command line tools. make is for compiling c code (among other things) command line tools can be downloaded with xcode through the app store.

How to run UIAutomation script from command line to Simulator

I have automated my iOS application using UIAutomation, To run this I launch iOS Instruments and run the script. If Same automation script I want to run to the device I use the below command which works as desired
instruments -w -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate myapp -e UIASCRIPT regression.js
But how do I run this from the command line to iOS Simulator ?
Please suggest.
Thanks
Sougata
If you don't supply the '-w' argument and build your app for the simulator sdk it should launch on the simulator.
In Xcode 6.0.1, running with the -w switch and passing in the symbolic name of the simulator appears to now be required (at least that's the only way I got it to work, and I've had others verify and point me to this solution).
See my answer from another post that has an explicit example.
You can also find a bash shell script that will handle invocation for you, automating the resolution of UDID and GUIDs in your simulator app paths.

Deploying iOS apps to /Applications from XCode via build phase script? (Jailbroken)

I'm developing a Cydia app. It's been in development for awhile, and I've never had any problems until recently, when I resumed development after a few months. There are a couple of things that have changed since the last time I worked on it:
Upgraded to Lion
Moved to Xcode 4
Updated to 4.3.5 on my iPad, iPhone to 5.0
From the research I've done, I've come to the conclusion that there was something "unusual" about my old setup. I've discovered that provisioned apps get put in the "sandboxed directory" /private/var/mobile/Applications, and system apps that get read access to the entire filesystem go in /Applications. I guess from using updated tools and Lion, I broke whatever was giving me system-wide read privileges. So, I need information on how to get Xcode to deploy directly to the non-sandboxed system directory.
There are some caveats though. I don't want to have to use an installer, I want Xcode to do it automatically after Build and Run. I also want to be able to have the debugger attached so I can view the console.
Can anyone with experience in this teach me how to use Build Phase Scripts to do necessary magic to take the signed binary and deploy it automatically after each build? I'd imagine this is indeed possible, because console output is such a valuable tool, that it would be too difficult to develop apps like Cydia itself.
Thank you for your help!
The general consensus among the community is that this isn't desirable. A build system like Theos coupled with on device GDB and either a syslog package or deviceconsole is what many are using.
I added a script as custom build phase. The script signs the app, create a package, copy it to the phone and install it.
The Build Phase is "Run a Script" with /bin/sh and I added "${PROJECT_DIR}/MyApp/install.sh"
The scripts (very basic - no error handling) is below (replace with appropriate values) :
(LatestBuild is a link to the build directory)
(ldid is installed with iosopendev project)
cd $HOME/Projects/iPhone/MyProject/MyApp
cp -r ../LatestBuild/MyApp.app com.test.MyApp/Applications/
ldid -S com.test.MyApp/Applications/MyApp.app/MyApp
rm com.test.MyApp.deb 2>&1
/opt/local/bin/dpkg-deb -b com.test.MyApp
scp com.test.MyApp.deb root#192.168.0.10:/var/root
ssh root#192.168.0.10 "dpkg -r com.test.MyApp"
ssh root#192.168.0.10 "dpkg -i com.test.MyApp.deb"
ssh root#192.168.0.10 "killall -9 MyApp"
#ssh root#192.168.0.10 "killall -HUP SpringBoard"
cd -
It can be improved a lot - but it just works for my needs
I'm not particuralry well knowledgable about xcode but like most IDE's im assuming in one shape or another that you can have it run a post build script if you can figure out what that is its as simple as an scp command to upload from there you can use ldid -S nameofapp in the dir that the app is uploaded to.
You can if you want allow your app to reside in /Applications though upgrading to 4.3.5 most likely forces you on a tethered Jailbreak I'm not aware of an untethered JB for 4.3.5 so thats a hassle if you wind up having to reboot.
As far as debuggers give gdb(you can get it from cydia) a go its really useful :). What Id do is just have xcode run a post build script to use scp to upload to your device then sign it manually with ldid thats the easiest way i can think of unless you have access to a developer idevice.
Give me a few minutes Ill write a script and try to describe how it works I need one anyone since i finally got a mostly working open toolchain. :)
A simple upload script
#!/bin/bash
scp -r $1 $2#$3:$4
$1 is lets say your app folder ill use my dpatcher as an example
$2 is user name either mobile or root(if you upload as root you need to chmod permissions to 755)
$3 is your idevices local ip(ie your routers ip for it)
you can find your ip with sbsettings or by going to settings tap the blue arrow next to your ap and it will tell you.
$4 is where you want it to be most likely /Applications or /var/mobile/Applications
i named it upload.sh but you can name it anything
An example
upload.sh dpatcher.app mobile#192.168.1.65 /Applications
Then all you do is ssh in and sign it with ldid -S nameofapp
If you want to upload single files remove -r as thats for recursive uploads(ie folders)
the reason that you must use scp or sftp for uploading files is that normal ftp AFAIK is not supported with out the use of 3rd party apps.
I'm not sure how to integrate with Xcode I do every thing with either vi, emacs or nano(and I don't own a mac).

libXcodeDebuggerSupport.dylib is missing in iOS 4.2.1 development SDK

Note: getting this on Xcode 4.3.2? Check out the answer to this question.
Note: creating a symbolic link to use the 4.2 lib seems to work fine
cd /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1\ \(8C148\)/Symbols/
sudo ln -s ../../4.2\ \(8C134\)/Symbols/Developer
After upgrading from 4.2.0 (beta, I believe) to 4.2.1, the libXcodeDebuggerSupport.dylib file is missing, which results in:
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).
which I guess isn't good. Looking at the directory in question I note:
.../DeviceSupport/4.2 (8C134)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib
but
.../DeviceSupport/4.2.1 (8C148)/Symbols/System/
.../DeviceSupport/4.2.1 (8C148)/Symbols/usr/
the above two dirs make up all the content in the 4.2.1 folder. No "Developer" folder. Checking the /usr/ dir there, I find no libXcodeDebuggerSupport.dylib file in the lib dir either, so ln -s'ing isn't an option.
Worth mentioning: after the upgrade, I plugged the iPad in and had to click "Use for development" in Xcode organizer. Doing so, I got a message about symbols missing for that version, and Xcode proceeded to generate such, then failed. I restored the iPad and did "Use for development" again, and nothing about missing symbols appeared...
Update: deletion of /Developer and reinstallation of Xcode from scratch does not fix this issue.
Update 2: I just realized that after the reinstall of Xcode,
.../DeviceSupport/4.2 (8C134)/Symbols
is now a symbolic link,
lrwxr-xr-x 1 root admin 36 Dec 3 17:17 Symbols -> ../../Developer/SDKs/iPhoneOS4.2.sdk
And the directory in question has the appropriate files. Maybe this is simply a matter of linking the 4.2.1 dir in the same fashion? I'll try that and see if Xcode freaks out. If someone who has this file could provide a md5 sum that would be splendid. This is what it says for me:
$ md5 /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2\ \(8C134\)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib
MD5 (/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2 (8C134)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib)
= 08f93a0a2e3b03feaae732691f112688
If the MD5 sum is identical to the output of
$ md5 /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1\ \(8C148\)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib
then we're all set.
What I just did to solve this problem was:
cd /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols
and created the symlink was missing:
ln -s ../../4.2\ \(8C134\)/Symbols/Developer/ Developer
It solves my problem.
If you do not have anything to lose, just dump the whole Developer folder (or Developer4.2 or however you call it). Reinstall from scratch with the official release of iOS 4.2 SDK - "Xcode 3.2.5 and iOS SDK 4.2".
I did that and found everything gets installed under 4.2 (8C134) only, and does not use 4.2.1 at all.
I do not have enough points to comment to the accepted answer.
Trinca's solution works for me.
Only one addition though:
I got a permission denied in Xterm when I tried to execute the ln command.
just had to enter
sudo xterm
and enter my admin password for the system
and repeat the process in the new terminal.
I am wondering how many people out there are re-installing Xcode because of this issue.
It is definitely a huge waste of time, if people went ahead with re-installation without checking for a better solution. Apple has to keep enough reviewers for sdk runtime checks, and not just for our apps :).
Trashing the folder does not properly uninstall Xcode.
Here are the steps to uninstall Xcode from the PDF readme distributed with the installer:
Uninstalling Xcode Developer Tools
To uninstall Xcode developer tools on the
boot volume along with the
directory, from a Terminal window
type:
$ sudo <Xcode>/Library/uninstall-devtools -mode=all
To remove the underlying developer content on the boot volume,
but leave the directory and
supporting files untouched, from a
Terminal window type:
$ sudo <Xcode>/Library/uninstall-devtools --mode=systemsupport
To just remove the UNIX development support on the
boot volume, but leave the
directory and supporting files
untouched, from a Terminal window
type:
$ sudo <Xcode>/Library/uninstall-devtools --mode=unixdev
Finally, to just uninstall the directory you
can simply drag it to the trash, or
from a Terminal window type:
$ sudo <Xcode>/Library/uninstall-devtools --mode=xcodedir
NOTE: The uninstaller that ships with previous versions of
the Xcode developer tools will not
clean everything off of your system
properly. You should use the one
installed with these Xcode developer
tools.
My gut feeling tells me that this process will properly nuke/replace dylibs like the one that is causing you trouble. At the very least, all trying this will cost you is time.
Do you have the image in ~/Library/iTunes/iPhone Software Updates you could add that to the xcode organizer and get the symbols from there maybe.
I had this issue as well and this did not work for me:
Quit XCode
Delete the folder /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1\ (8C148)
Plug in your iPhone
Bring up the organizer. It should ask you to collect the symbols from your phone.
Wait while it collects and processes the symbols off your phone.
To resolve this issue, I simply copied the the following directories to the /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols directory:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/lib/info/
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/Developer/
Once copied over, debugging on the device works normally and no more error messages in the console are received.
Hopefully this helps others that are struggling with debugging on 4.2.1 devices.
Happy Holidays!
What I did was just navigate over to /Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest/Symbols/ and just drop the whole Developer folder into /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/
Worked! :)

Does iPhone OS 3.0.1 ruin your development phone?

I updated my phone to 3.0.1. While the phone works fine as a phone, xcode organizer no longer knows the name of the phone. It also says 3.0.1 is unsupported by this version of xcode.
I downloaded the latest version of xcode and OS (3.1). Now, I'm trying to move my phone from 3.0.1 to 3.1. I'm pressing option-restore in iTunes (does this bring in the beta OS?). It tells me all the data on my phone will be erased.
How should I proceed?
Please execute the following and you will be fine, NO NEED TO RESTORE THE IPHONE,
Log into your Mac with an Admin account and launch the Terminal application
(/Applications/Utilities)
Copy and paste the following (one) line into Terminal:
ln -s /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0\ \(7A341\)
/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0.1
make absolute sure that that you execute the ln -s command correctly and make certain you didn't get any errors. After the command executes correctly you should be able to do this:
ls -l /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0\ \(7A341\) /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0.1
and see this:
/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0.1 -> /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0 (7A341)
No. Just type the following line into the terminal (make sure you are logged in as an admin):
ln -s /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0\ (7A341) /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0.1
I would not recommend updating to 3.1 unless there are specific 3.1 features that you would like to use in your app.
After lots of messing around (with much guidance from people here), I got some understanding of the OSX file system. My files were not set up as expected (maybe because I upgraded XCode to 3.1). If anyone else runs into the same issue, here's what you need to do:
1) Log into your Mac with an Admin account and launch the Terminal application (/Applications/Utilities)
2) Check to see where your system keeps files for supporting iPhone 3.0:
ls -l /Developer/Platforms/iPhoneOS.platform/DeviceSupport/
3) Look for a file like 3.0. You may see "3.0" (like me), "3.0 (7A341)", or something else
4) Make a link so XCode looks for 3.0.1 in the 3.0 location. Some examples:
ln -s /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0 /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0.1
ln -s /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0\ \(7A341\) /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0.1
5) Confirm this works by restarting XCode and opening the organizer
As Benjamin points out, do not upgrade to 3.1 unless really needed.