Installation Failed “Invalid argument” when trying

2019-01-13 14:57发布

I added a vanilla Today Application Extension and run with the new scheme created by XCode.
After it finishes building ("Build Succeeded" pops up), it failed straight away with this error:

Installation Failed
Invalid argument

I've been trying to find answers for 6 hours now, no luck so far. Please help!

11条回答
Lonely孤独者°
2楼-- · 2019-01-13 15:44

This can also happen in Xcode 7 because "Upgrade to recommended settings" will change CFBundleIdentifier to point to $(PRODUCT_BUNDLE_IDENTIFIER) instead of the old $(BUNDLE_IDENTIFIER).

Apple says in the Xcode 7 release notes that PRODUCT_BUNDLE_IDENTIFIER is now "the recommended place to set the Bundle Identifier for a target." So if you're using BUNDLE_IDENTIFIER anyplace else in your project, be sure to change it to PRODUCT_BUNDLE_IDENTIFIER to keep things in sync.

查看更多
\"骚年 ilove
3楼-- · 2019-01-13 15:46

Image description here.!! I got this Error Just Enter Bundle Identifier. (You can get bundle identifier by right click on info.plist and go to Open as than Source Code here just find this CFBundleURLSchemes below this name a string tag contains your bundle identifier) Copy Bundle identifier and past it on TARGET select General now on Identity you will see Bundle Identifier paste there and enter. then just run the code. Happy Coding!!!

enter image description here

enter image description here

enter image description here

查看更多
Summer. ? 凉城
4楼-- · 2019-01-13 15:47

What I found is that info.plist file should never been localized! I tried to localize my project and tried to tap Localization on all plist and string files. As a result, I could not install my app to Simulator, invalid argument error.

I spent 1.5 days trying to find out reason. I tried all the solutions as listed above, but with no luck. Finally, discard all my localization changes and redo it again. This time, I tried to localize one file first, and then compiled codes and trie to run my app on Simulator.

The issue is info.plist file. You could localize it. The result is that en version is moved en.lproj folder. That is to say, no more info.plist file in the project folder. As a result, Xcode could not find it and exception raised.

Another way to verify it is to check your project settings. Select your target and general tab. The Identity should be like:

enter image description here

If your project settings are something like this, you have to locate info.plist, that means info.plist is missing.

enter image description here

You just cannot locate localized info.plist in en.lproj folder from project settings.

enter image description here

Don't localize info.plist file directly. You can localize it by localizing infoplist.strings file.

This may be one of reasons to get invalid argument exception, as in my case.

I also wrote a blog on this.

查看更多
我欲成王,谁敢阻挡
5楼-- · 2019-01-13 15:49

I got the same issue and it was because of low memory on phone. I deleted some apps and restarted the phone which brought by available storage.

查看更多
别忘想泡老子
6楼-- · 2019-01-13 15:54

I got this error after installing new pods (AWS) to my project. Somehow the entry in the Build Settings for Info.plist file was cleared. Entering the correct filepath (find in finder) my project finally compiled again.

查看更多
登录 后发表回答