Argument invalid with every build in Xcode? - iphone

No matter what I try, I get an Argument is Invalid error in Xcode when I try to build to my iPhone. It works fine in the simulator. The problem is not specific to one project, it happens with any project, even when I create a new one. When I run the console it displays this
I tried deleting and re-adding the provisioning profiles, and I've gone through every setting to look for spaces because I heard these can cause this error. Can anyone help? I don't know what else to try.

If you have a symbolic link (ln -s) in your project directory, it will work on the simulator, but cause a “The argument is invalid” error if the target is a real iOS device. (Xcode 4.5.2)

You may check if you have a space somewhere in the settings, such as the product name or so. These cause these kind of errors in many cases....
Also sometimes a symlink in your bundle can be the reason - depending on how you set up your file structures in the app bundle...

Actually this looks like and xcode error because it cant find those .m files. So here is a post that responded to hopefully it helps. It looks like you are gonna have to do some installation and reinstallation. XCode Update - iOS Link Error

I am assuming you are working with Git. This often happens due to issues in your local build. Take the latest pull from the develop branch and check if this solves your issue. If this doesn't work, you might want to manually check the build settings for your app.

Related

Unable to run app in Simulator Xcode 6

Yesterday i was testing my app in the iOS simulator and everything was working fine. I then decided to run the app on my iPhone and i got the error unable to install application, Unknown error occurred this has happened before so I cleaned my build folder (as this has fixed this issue before) however, the same error occurred. I then ran the app in the iOS simulator again and now i get the error Unable to run app in Simulator, An error was encountered while running (Domain = LaunchServicesError, Code = 0). I find this very weird as i didn't change anything besides trying to run the app on my iPhone. I have tried every solution given on this post and still no luck.
I'm sorry if my question doesn't contain much detail but as I said I didn't change anything and it was building and running fine a minute before plugging in my iPhone and trying to run it on there.
Any help would be much appreciated.
edit
I tried running other projects (with and without extensions) and they are working on both simulator and iPhone, therefore the problem must be within my project. (my project does have a today extension)
In that kind of cases I usually :
Product > Clean
Close xCode
Delete the Derived Data (in ~/Library/Developer/Xcode/DerivedData subfolders)
Delete the app on the iPhone
Reboot the iPhone
Restart and rebuild
I had this problem. In my case, it was caused by the Build value being blank. After putting a value there, and resetting the simulator once more, the issue went away.
I had the same problem and checking the system log carefully helped me to identify a coliding library that was causing this error. You can also check this answer if you are using extensions.
Generally it means there is a problem with the build, it may be due to old cache (solved by a clean build) or a project definition error (missing library, bad definition in info.plist, etc).
In my case it happened only on iOS 8, turns out that my widget had the wrong bundle ID.

Unable to run app in Simulator : An error was encountered while running (Domain = LaunchServicesError, Code = 0)

I am unable to run my app in simulator after having trouble with the provisioning profile. I'm doing swift coding in Xcode 6 - beta 4. This was fine before the trouble in the certificate's profile.
I have tried cleaning the build.
Checked the command line to xCode6-beta4 for running.
Checked the build deployment, set to 7.0 so swift won't complain for compatibility
Fixed the error in provisioning.
I fixed it by resetting the simulator:
iOS Simulator > Reset Contents and Settings...
This happens if your extension's bundle ID isn't prefixed with your app's bundle ID. For example if you app is com.mycompany.appname, your extension should be something like com.mycompany.appname.today.
Something else to note, if you're using Swift and are setting a principal class with NSExtensionPrincipalClass, you'll want to make sure your extension target sets "Defines Module" to "Yes" and make the value of NSExtensionPrincipalClass equal to "YourModuleName.YourClassName".
It seems that there are multiple reasons for "domain = LaunchServicesError code = 0" error. I also encountered it, while I try to reinstall app on iOS8 simulator. I cannot reinstall but have to delete the old app first.
The problem was solved by:
In Xcode, fill empty Version or Build field with appropriate value in your Target->General->Identity
In Simulator, reset Content and settings...
After that, everything works fine.
This also happens when you remove the default StoryBoard from template created project of a Today widget. To fix this, I added the NSExtensionPrincipalClass under NSExtension and pointed it to the class containing the Today Widget View Controller, which is by template default TodayViewController.
This looks like this in the Info.plist of the extension:
NSExtension
NSExtensionPointIdentifier String com.apple.widget-extension
NSExtensionPrincipalClass String TodayViewController
Product -> Clean
iOS Simulator > Reset Contents and Settings
Restart XCode
None of the above worked for me, however deleting the Derived Data fixed the issue.
To delete the Derived Data, go to Window > Projects, select the current project, and press the appropriate delete button.
"Reset Content and Settings" from iOS Simutalor menu options and launching simulator after Quitting solved my issue.
The solution for me was not to embed a framework that hadn't been built as an embeddable framework.
Found the cause of the problem for me.
I am using ShareKit via pods. This issue is related to the GooglePlus SDK which ShareKit uses and this has to be updated due to a policy change by Apple.
http://googledevelopers.blogspot.com.br/2014/09/an-important-announcement-for-ios.html
So i replaced my pod "ShareKit" with:
pod "ShareKit/Twitter"
pod "ShareKit/Facebook"
pod "ShareKit/Pocket"
pod "ShareKit/Evernote"
Leaving out the GooglePlus sub project and the application has deployed and runs fine under 8.0 simulators now.
Hope this helps somebody else.
I have resolve this issue. thanks for the advices. :)
This issue always happens when you build your keyboard extension app with same identifier as your main bundle. like this.
If you have this "com.codemagnus.ExAppMain" in your main bundle, your extension should also have this identifier "com.codemagnus.ExAppMain" .. This will result in launch service error if you are going to run in simulator. But you can create a build. However, the issue I have found was annoying. This app can't be install in your device. :/
If you want to run in simulator. You should have this "com.codemagnus.ExAppMain.ExApp" in your extension keyboard where ExApp was you extension name. And your main bundle should be "com.codemagnus.ExAppMain".. This will run perfectly with the simulator. However will result in "Embedded binary's bundle identifier is not prefixed with the parent app's bundle identifier."
Embedded Binary Bundle Identifier: com.codemagnus.ExAppMain.ExApp
Parent App Bundle Identifier: com.codemagnus.ExAppMain
I'm still thinking and looking for a solution to solve this issue for ipa build.
This drove me crazy. I checked everything suggested here, reinstalled Xcode, restarted my computer and nothing worked. After checking some previous commits, I found out the issue.
For context, I am working on a custom keyboard extension in Objective C. Adding a new custom keyboard extension target gives you a KeyboardViewController stub class with the "next keyboard" button. I changed the NSExtensionPrincipalClass value in the Info.plist of the extension to be a class name different from KeyboardViewController and started work on it. Eventually I decided to get rid of the the stub KeyboardViewController since it was dead code.
Deleting the KeyboardViewController files and removing them from Xcode caused this problem to happen. Putting them back made the app work again.
In my case, this has resolved the issue.
Bundle Identifier should not be empty. You can find the field with the below reference:
I got this error because I mistakenly changed the value of NSExtensionPointIdentifier. I thought it was supposed to be an ID for my extension, but it has to be one of these values indicating the kind of extension it is.
I started getting this error when I changed my Deployment Target from 6.0 to 7.0. I found that resetting the simulator did solve the issue, and I needed to do this for ALL the simulators that were relevant to the app. But if I went back to 6.0 and recompiled for any particular simulator, then it worked immediately, but going again to 7.0 broke the simulator and I had to clear the settings again.
Obviously the Deployment Target affects the coding in the simulator, and the coding is downward compatible, but not upward. Plus, the log message isn't extremely helpful, saying the app couldn't be hardlinked to a cache file using a manifest (giving the pathnames to the app, cache, and manifest, of course).
Make sure you check build settings; scroll down to the very bottom and make sure your User-Defined Bundle prefix is correct. Usually com.whatever.
Just setting it at the top doesn't always change this bottom setting. This finally worked for me after resetting simulator, frying the derived folder, etc.
I'm under IOS 9.3, xCode 7.3
Xcode 7.3
This could simply happened because your target name is too long. Try change your target name to something shorter ( remember to change your bundleIdentifier to match ).
If you are using apple watch besides the bundle identifier you also have to make sure that in info.plist the key WKAppBundleIdentifier contains the right watch app bundle identifier.
I was getting the similar error while launching the app, thru xCode, "The parent bundle has the same identifier as sub-bundle..."
I shortened the Bundle Identifier in the "Project -> General" for xCode8. Initially, my bundle id was com.companyname..
The application name was more than 20 characters. Once I shortened it 12 characters, it worked for me.
To understand what is causing this error you need to go look at the simulator log files first. These are typically located in ~/Library/Logs/CoreSimulator/CoreSimulator.log or a similar location. So I'd strongly recommend you first look at the log to idenify the root cause and then research that further. (You can take a look at this thread to see where logs are located.)
For example if you get an error such as ErrorDescription=Failed to chmod /Users/username/Library/Developer/CoreSimulator/Devices/then it's probably easiest to reset your simulator. For errors such as ErrorDescription=WatchKit 2 app's bundle ID com.mydomain.AppName.watchapp is not prefixed by the parent app's bundle then there is probably an error with how you have set up the main bundle ID of your project.

XCode error "The application bundle does not contain a valid identifier."

Recently, after upgrading to Lion and Xcode 4.2.1 I am getting this error when trying to run my app on my iPhone 4S:
"The application bundle does not contain a valid identifier."
My identifier is indeed valid, and I have been able to run my app with this identifier earlier.
The problem might appear when I change computers.
I have two computers that I am using to code my app, and I am using Dropbox to keep track of my files.
Restarting XCode, my mac and my iPhone does not work.
Cleaning the target and rebuilding does not work.
The only thing I have been able to do to fix it is to create a completely new project and moving my files. This made things work until I swapped computer. Now I am in the same trouble again.
Any idea? Anyone?
Three suggestions:
Check that your developer key is in both computers
Did you try to update the project? There is a strangly-named key in the middle bottom under the project's properties. Try this.
I had similar issues. I found that some things weren't updated when I updated osx and xcode. To get out of the situation, I would suggest creating a new project and copy paste code, files and build settings. This might seem stupid, but you know apple is not good at creating IDE's. You might just get your self lost in the undocumented settings.

Why do I get "could not be added to your itunes library because it is not a valid app" error when trying to install Ad-Hoc build?

I've recently upgraded my Mac to Lion, and also Xcode 4.
In Build Settings, I've set "Code Signing" for "Release" to be "iPhone Distribution" which matches our Ad-Hoc provisioning file (which we've used in the past, on Snow Leopard/Xcode 3).
I have deleted the old Entitlements file (as it's apparently no longer used by Xcode 4).
In the Scheme section, I've set Archive to use the Release build.
I'm building with Product > Archive.
I'm saving the file by going into the Organiser and clicking Share, then making sure the same Ad-Hoc provisioning is selected.
I'm sending the resulting IPA file to my boss, who has previously installed this app. When he tries to install it, he gets the message "[appname] could not be added to your itunes library because it is not a valid app".
I've been trying every combination of settings I can think, but we just cannot get this to work. I can find this error only twice in Google - once from someone with a jailbroken phone and another posted in comments of an article, someone having the same issue, but there are no responses.
Any help would be really appreciated.
Edit: Same thing happens trying to drag the IPA into iTunes on the Mac that created it! :(
Edit2: Just taken another (almost identical) project and tried a build without "Modernizing" the project, or selected any of the new options in Xcode (icons, launch images, orientation etc.), and this build works. I'm going to work through each of the things I did with the original app with this one, testing at each step. Hopefully should be able to isolate which step is breaking the compiled app!
(also posted to Apple Dev Forums)
I believe I've tracked this down... It seemed to be happening really intermittently, so it's taken some time (I'd reproduce it, roll back the change, confirm it worked, then re-apply the change, for it to then work again!).
However, after much cleaning/restart/etc., I believe it's related to the "Build" version in the target settings (there are now two version fields, "Version" and "Build"). It seems that if "Build" is blank, then this error occurs.
Unfortunately, changing this value doesn't seem to rebuild properly, so sometimes if you change it, then Archive, you still get the previous value. Manually cleaning before Archiving seems to work around this.
The value gets written into the plist file as CFBundleVersion.
Recently I suffered a problem with an Ad-Hoc installation using TestFlight service, the message in the log didn't help too much:
Jul 25 12:52:39 MyiPad installd[477] <Error>: 0x10059c000 init_pack_state: Archive we've been requested to install is 0 bytes. That can't be a valid ipa.
After many tests, I found this question and the problem was the same, the Build field was empty (this answer save my day :-) )
So, if anyone else has this problem on TestFlight, I hope my answer allows to find this page easier ;-)
I also faced the same issue. After doing some research found below answers as:
App Version and Build version should not blank.
Don't put special characters in my app bundle name.
And also there was no issues with my provisioning profiles.
After debugging found that there was name mismatch in my scheme name and info.plist file name. In my project, I have 3 schemes like a,b,c and only one a-info.plist file. I was creating IPA for different scheme like 'b'.
In your scenario, if you have created multiple schemes then check your Info.plist name. That should have to be same as your scheme name (for which you are creating an IPA).
Example. The scheme name is 'myScheme' then your Info.plist file name as 'myScheme-Info.plist'.
Hope this will help you.
I got the same message ("not a valid app"). In my case, I was FTPing the built app to a web server then I would be able to OTA provision it. I was not swapping to binary mode before I was putting the file, so the .ipa file got corrupted on the way. Took me most of the evening to figure that stupid mistake out...
ok.. do one thing.. Open info.plist.. Go to bundle identifier and change bundle identifier name. It needs to be unique.. something like "com.yourcompany.projectname" and create and try to install the ipa.. It should work
I came across this question while researching a similar problem so I'll answer here even though the cases are not identical, because others will search for the same error message.
I had an ad-hoc app that everyone in the development team could install fine, except one person, who got the error from iTunes:
X is not a valid app
He had been able to install earlier versions of this app. Rebuilding the app, changing the version number and changing the build number had no effect, he still could not install but others could.
I fixed it by creating a brand new Xcode project, either copying the files or copying and pasting the content of the files from the old project to the new one, and rebuilding the app and signing it in exactly the same way as the old project. It worked.
I had a similar issue while trying to create an .ipa for adHoc distribution for one of the Old project (built a year ago by ex-developer). After a lot of research in google and following the above solutions it didn't worked out for me somereason.
Later after following this link - here. By replacing the .plist file with the existing working projects (obviously - the relevant icons/bundle display name/identifier) and renaming with the current .plist name. It worked for me.
I literally spent about 3-4 hours to fix this issue. Hope it helps some one.
environment was native - iOS app.
add......
"Application requires iPhone environment" in your info.plist or if added give it value "YES".
Check "Build" and "Version" in general are not empty....
hope this will work
Importing the project contents in to a new Project solved the issue for me.
For me, we were trying to do an enterprise build of a very old app, from iOS 5.
After confirming profiles and everything else was fine, debug builds work correctly, I noticed the general consensus was around issues with the info.plist file.
I compared the info.plist with another app and sure enough,
Application requires iPhone environment = NO
Basically this key needs to always be set to YES for iOS apps regardless whether its for iPhone, iTouch or iPad...
It may not be limited to that key for everyone but make sure the info.plist looks similar to working apps.
Bundle version
Bundle versions string, short
should always be present!
right.. but I guess it is clashing with earlier bundle identifier( this happens because you have upgraded the Xcode). Did you try and change the existing bundle identifier name and install ? I had identical problem and wasted 3-4 days.. I changed existing bundle identifier name and it worked.. Also you may want to check Bundle name and Bundle version are present in info.plist

Error Installing iPhone App on Device

I set up all my certificates and keys today and am trying to run my project on my iPhone.
I'm encountering this strange error:
Your mobile device has encountered an unexpected error (0xE800003A) during the install phase: Verifying application
Poking around the Apple Developer forums, I've attempted to set new certificates and provisioning profiles as well as editing Info.plist, but no matter what I do I can't seem to run the app on my device.
The only think I can currently think of is that my project name in Xcode differs slightly from my development provisioning profile (it uses a question mark), but I've named it according to Apple's conventions: com.mycompany.myapp, so I'm unsure if that's the problem.
Any ideas?
Edit: I've hard restarted the phone, rebooted Xcode, cleaed my targets, set up a new wildcard App ID and respective provisioning profile and still nothing. Any other ideas?
It turned out that I had 2 certs in keychain that were simultaneously overwriting each other! I hope this helps people in the future.
You should create a wildcard app ID; com.mycompany.*. That may help.
I've encountered this on many occasions. What i do is clean all targets, shut down xcode, and hard reboot my phone.
This is a different error than the more common problem of getting the cert wrong...
Restore the phone (using the XCode Organizer to reload the latest OS), to be safe do not restore from backup when you sync with iTunes the first time (it'll still keep your number when you sync even if you don't use the backup). I've had to do this a very few times, the last one was when it was in the middle of deployment when I unhooked the phone from the cable (had to answer a call).
Try the reboot (of the phone) first, hooking it up with XCode off. But if that does not solve things, restore is the way.
The console tab in the XCode Organizer sometimes gives helpful hints as to what happens during the install phase. In one case my problem was my app already existing on the phone. I deleted my app and the install succeeded.
Regardless, it looks like a lot of error messages are bundled into this one cryptic message and to really diagnose what is going on, I found the Console tab very useful...
One other thing to try is reinstalling the iPhone SDK. I ran into an error like this when I first got my developer key and this was the only way around.
Just want to say to everyone, when you go to edit Targets-> be sure to set "configuration" in the top left corner to "All Configurations" or the correct config you are building for (Debug or Release). You might think you have things set correctly but it will be for the wrong configuration.
I've seen that error on a correctly provisioned device that has had success installing apps from XCode before, and I've had luck restarting the device and trying again. Maybe that will help.
Try running in Release mode instead of Debug. I have a working project with this problem. No idea what the issue was, but running it in Release mode works, but Debug mode produces the error code.
I have a support ticket open with Apple dev support for the same problem, and (FWIW) I'll post their recommendations if and when they can get my toolchain working.
Try this: (source: http://ephemera.lifewithalacrity.com/iphone_development/)
Even though this is supposedly only for Distribution builds, it helped me to be able to install my Debug version on my iPhone again, after it mysteriously broke yesterday.
"just triple check that all the code signing in your project properties are clear or default"
Note, this is the PROJECT properties as opposed to the TARGET properties. I set my Code Signing Provisioning Profile back to the default and removed the Code Signing Identity string.