Xcode - "The Argument Is Invalid" - ios

I am trying to create an Ad-hoc version for beta testing(.ipa extension) of an ios app I made. The problem is that whenever you try to install the app via Xcode>Organizer>DEVICE>Applications>Add I get a message saying "The argument is invalid". The app installs just fine on the simulator and all of my devices with no warning or errors if you installing it via the "Build and Run" button. I just get this message when trying to install the .ipa. I have double checked the Provisioning Profile and the device(s) are correctly added. I am code signing the project to the "iPhone Distribution" Profile with all of the correct devices. Also, from reading similar questions on here (Q1,Q2) I though it might be a symlink problem. I removed all of the symlinks and still get this error. I ran
find ./ -type l -exec ls -l {} \;
to find all the symlinks and after fixing all of them when I run that command it doesn't return anything.
Any ideas on how to fix this error?
Thanks :)

After nearly 8 hours of messing with Xcode I figured it out. It turns out that the Appirater library, which I had included via Cocoapods, had 1 symbolic link that was messing everything up. I just installed Appirater myself(and removed it from Cocoapods) and now everything works fine. Hope this helps anyone with the same problem in the future. :)

Related

Xcode / Why do we need to copy ~/Library/MobileDevice/ to /Library/MobileDevice/?

While running the command cordova run ios, or ionic run ios, I came across this error:
Check dependencies
Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “31e9e9bb-8da1-48c6-9256-ec365145a0ac”, however, no such provisioning profile was found.
CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 7.1'
At first glance, I decided to refresh my provisioning profiles, ensuring that they were valid and reachable.
However, same issue occurred.
I'm pointing out that running the app from Xcode directly worked/works great.
Until I ... came across this post, suggesting to run this command:
cp -r ~/Library/MobileDevice/ /Library/MobileDevice/
Tried it and...the whole works!
I found that very...ugly and totally non-intuitive.
May anyone explain the essence of this kind of copy?
Isn't Xcode smart enough to handle that automatically?
That works, indeed, but I never want to admit things I don't figure out ;)
I don't understand what I've done.

"The codesign tool could not be found" from Xamarin Studio

I'm trying to generate an IPA file for my App from Xamarin Studio, on Mac, and i'm getting this error:
"The codesign tool could not be found"
I checked the certificates, provisioning profiles, etc. I generated apps before in this machine, using the same developer account.
From Terminal i can see that codesign command is being recognized, but maybe Xamarin Studio is looking for it in a different place.
Similar problem in XCode
I tried to generate the IPA from a random project in XCode and it gave me a similar error:
"can't exec 'codesign'"
Then i found an issue on stackoverflow that said to copy the codesign program from /usr/bin to /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u‌​sr/bin
I did that and everything worked fine in XCode, but still getting the same error from Xamarin Studio.
Any ideas?
Thanks in advance!
I don't know anything about xamarin, but chances are you don't have command line tools installed. Go to preferences and downloads. I think it comes standard with Xcode 5 now, but maybe not.
Since i was totally out of time, and needed a workaround, i reinstalled the OS and all the tools, and it did the job for me.
I'm sorry i couldn't get to a more concrete solution for this problem.

Xcode 5 "error: can't exec 'codesign' (No such file or directory)"

Someone recently posted a similar issue at can't exec 'codesign' (No such file or directory)
However, for whatever reason, it has received a down-vote rather than something helpful. So I am going to try to post this myself, with some additional data in hopes that some kind SO'er has been through this or just knows what the problem is.
I have a project that builds fine under Xcode 4.x, but ever since installing Xcode 5 DP2 (and DP3,4 and 5) and now the released version, I get this error when trying to build or archive to anything but the simulator:
CodeSign /Users/cb/Library/Developer/Xcode/DerivedData/MyApp-bdtrjmwxxokvesathmrttgwwesfq/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app
cd /Users/cb/Development/MyAppCore/FrontEnd/Mobile/iOS/MyApp
setenv CODESIGN_ALLOCATE /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH:/usr/local/mysql/bin:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin"
Using code signing identity "iPhone Developer: CB (D4HZSHL6DF)" and provisioning profile "MyApp_DEV" (BB1C0589-147E-4E12-945D-8FB093B70C70)
codesign --force --sign F5...B73 --resource-rules=/Users/cb/Library/Developer/Xcode/DerivedData/MyApp-bdtrjmwxxokvesathmrttgwwesfq/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app/ResourceRules.plist --entitlements /Users/cb/Library/Developer/Xcode/DerivedData/MyApp-bdtrjmwxxokvesathmrttgwwesfq/Build/Intermediates/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Release-iphoneos/MyApp.build/MyApp.xcent /Users/cb/Library/Developer/Xcode/DerivedData/MyApp-bdtrjmwxxokvesathmrttgwwesfq/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app
If I open Terminal and cd to
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/
and then run the command from there, it executes just fine. So the tools seem alright, as do the provisioning profiles. The problem seems to be with Xcode itself.
It should be noted that I have deleted Xcode completely, as well as my codebase, along with all provisioning profiles and certs. I re-checked-out my code, and re-installed Xcode 5 from a fresh download, entered Apple ID into Xcode and re-created/fetched the certs and profiles, and still have the same issue.
I also went in to the project file itself and removed duplicate PROVISIONING_PROFILE entries per a couple of answers I found, to no avail.
I can build this same project from 2 other machines using Xcode 5, so it is something happening specifically on my box, or with my particular installation, it would seem. But other than that, I am stumped.
Has anyone seen/fixed this, or have any ideas of where to look for an answer?
Thanks for any input!
I copied codesign from /usr/bin/
to:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u‌​sr/bin
and it worked for me.
Try this:
For Mountain Lion before starting signing process Please run below command as first command.
For Xcode 4.x:
export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate"
For XCode 5:
export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate"
Solved my problem, thanks for the help. The issue was with my path. I had set my path via /etc/launchd.conf and I was driving myself insane trying to edit my path via ~/.bashrc etc. Make sure /usr/bin is in the path that xcode picks up. This page reminded me: http://overwatering.org/blog/2012/08/setting-path-osx-mountain-lion/
If you added the flag --deep to "Other code signing Flags" i.e. using cut copy paste, it may happen that an "invisible" char was added. In this case the error message is like:
/usr/bin/codesign --force --sign "" --deep --entitlements (...)
No such file or directory
If you see those two quotes "" then there is an invisible char before '--deep' in your compiler settings.
In this case the compiler throws the error message "No such file or directory".
(/usr/bin/codesign seems to not be existing, but it is (!))
To resolve this issue go to build settings, search for 'Other code Signing Flags', delete all entries, and retype them manually (no cut copy paste).

"Unable to download application. <Appname> could not be installed at this time"

I'm almost dead now. I've been trying for about 2-3 weeks to fix that problem, but still no result. Hope anyone is able to help me:
I'm writing iOS Apps with Titanium Studio. Until Mac OS X 10.6.8 with Xcode 4.2 everything worked just fine. I was perfectly able to build apps in Xcode und deploy them In-House in our Enterprise. Now I've upgraded to OS X 10.8.2 with Xcode 4.5 and there we go...
Apps can still be built and are runnable on the iOS Simulator, but if I try now to get the app on some devices, I get a message "Unable to download application. -Appname- could not be installed at this time". This happens either through OTA distribution and through iTunes with an USB Cable.
I've searched almost the entire internet, but all I've found didn't work at all.
But if I actually try to deploy the application through Xcode it works though.
Does it have something to do with those Profiles and certificates? I've already tried to revoke them and so on, but nothing helped. I also installed OS X completely new, so that I have a clean keychain. Same result.
Would really really appreciate any kind of help. Thanks!
Finally i found a solution, when i tried to sign the App manually, the console threw an Error message that helped me to fix it again.
The Problem started when i upgraded to Mountain Lion and had to update xCode to 4.5.2
Maybe it helps others who still couldn't find a solution after several days of searching the internet
Unzip the Ipa
unzip Application.ipa
delete _CodeSignature
rm -r "Payload/Application.app/_CodeSignature" "Payload/Application.app/CodeResources" 2> /dev/null | true
if there isn't the right provisioning profile, replace it
cp "ProvisioningProfile.mobileprovision" "Payload/Application.app/embedded.mobileprovision"
The problem for me was this error when i tried to resign the app manually:
"object file format unrecognized, invalid, or unsuitable"
fix it :
export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate"
resign the app
/usr/bin/codesign -f -s "iPhone Distribution: Company Name" --resource-rules "Payload/Application.app/ResourceRules.plist" "Payload/Application.app"
Zip it
zip -qr "Application.resigned.ipa" Payload
Thanks to
This Question on how to sign an app manually,
the console which got me the error
This Post which helped me to fix the error
Apple which makes our lives too hard
Update
It seems the location for codesigning has changed. The new path would be
export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate"
As taken from this answer
I had the same “Unable to download application. 'Appname' could not be installed at this time” message, and spent several weeks checking and renewing the certificates, rebuilding, re-doing the OTA distribution, etcetera. It turned out that I simply hadn't added the .mobileprovision files to the project. Just in case this helps anyone…

"Command /usr/sbin/chown failed with exit code 1" when Archiving

I am trying to archive my first iOS 4.3 Application for iPhone and I always encounter this error:
Command /usr/sbin/chown failed with exit code 1
I have searched through various forums, trying solutions such as changing the Alternate Install Group (which I don't know what to change to), and turning on 'Skip Install'.
As dumb as it sounds, in XCode 5.1.1, all I had to do was quit out and restart XCode just now. I know it's not much of an "answer" but it just worked for me.
Edit: this is still working as of July 2018 for folks.
Edit: this is still working as of January 2019 xcode 9.4.1
Edit: this is still working as of February 2023 xcode 14.2
I was having difficulty with the SetOwnerAndGroup part of Archiving - I was getting /usr/sbin/chown failed, and it was getting 'operation not permitted' on each file it tried to 'chown'.
This was easily tested in the terminal - 'chown' doesn't work, but 'sudo chown' does. Since I had no need to be changing file permissions, the simplest solution was to not do the chown.
The screenshot above shows - I just blanked out Install Owner/Group, and that did it.
When I got this error, rebooting my computer fixed it.
I have tried all the other solutions but none of them worked for me. So I have run this on a terminal to change the owner to me on every file in my project:
sudo chown -R my_username:my_group ./my_project_folder
where "my_username" is you username, "my_group" is your group (this is usually staff) and "my_project_folder" your project's folder.
None of the other solutions worked for me on Xcode 4.5. What I had to do was the following:
The fix is by removing the armv6 architecture from both your project and the CordovaLib project, clean
both projects, and rebuild.
Source
To it works in my environment I cleaned all information about permission, as +adalle said, complemented by Tom and Phil
I emptied the fields Install Group, Install Owner, Install Permission including the Cordova SubProject
I had the same issue with Xcode . It started working after restarting Xcode.
In the screenshot , Xcode ->build settings , installed group was empty after restarting Xcode .the group id it has showed as some number.
Not sure if this is the same problem you are having, but this fixed it for me:
When I created my XCode project, my app name had a space in it, so trying to deploy my app always failed. I was able to fix this by using a Custom Archive Name.
In XCode 4...
Edit the Deployment Scheme
Click on the Archive tab
Then specify an Archive Name that doesn't have spaces in it.
I tried all possible variants and they didn't help me. So I downloaded old XCode 4.4.1 and voila - application archived successfully :)
Select the target that's giving you the error
Change Build Active Architecture Only from Yes to No
That worked for me.
For me reboot my mac fixed it. OS High Sierra, xCode 9.2
When this happens to me on Xcode 8, I do "Clean build folder" 2 times (the first time it throws an error, but the second time succeeds) and then archive again.
Note: The "Clean build folder" option is under "Product" Menu, hold the alt button and you will see the "Clean" option changing to "Clean build folder".
Clean your project.
Clean your build Folder. (Product > ⌥ > Clean Build Folder)
Set the target device to Generic iOS Device .

Resources