ios 尝试运行 Today 应用程序扩展时安装失败“无效参数”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27037589/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 03:42:23  来源:igfitidea点击:

Installation Failed "Invalid argument" when trying to run Today application extension

iosios-app-extensionxcode6.1

提问by foct

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

我添加了一个 vanilla Today Application Extension 并使用 XCode 创建的新方案运行。
完成构建后(弹出“构建成功”),它立即失败并显示此错误:

安装失败
无效参数

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

我一直在努力寻找答案 6 个小时,到目前为止还没有运气。请帮忙!

回答by user2866588

Check if the Bundle Identifier isn't empty in the Info.plist

检查 Info.plist 中的 Bundle Identifier 是否不为空

回答by user3719188

Try this:

尝试这个:

  1. Quit Xcode
  2. Clean out ~/Library/Developer/Xcode/DerivedData manually
  3. rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
  4. iOS Simulator > Reset Content and Settings
  1. 退出 Xcode
  2. 手动清理 ~/Library/Developer/Xcode/DerivedData
  3. rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
  4. iOS 模拟器 > 重置内容和设置

回答by GiovaMaster

Maybe you are bundling a conflicting "contents" referenced (blue) folder.

也许您正在捆绑一个冲突的“内容”引用(蓝色)文件夹。

Hint: change the name of said "contents" folder :)

提示:更改所述“内容”文件夹的名称:)

回答by lukas_o

This issue occurred in my case when the phone's memory was too low to install the app. I've cleaned up the phone and voila!

这个问题发生在我的手机内存太低无法安装应用程序的情况下。我已经清理了电话,瞧!

Another hint might be this post.

另一个提示可能是这篇文章

回答by jemmons

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

这也可能发生在 Xcode 7 中,因为“升级到推荐设置”将更CFBundleIdentifier改为指向$(PRODUCT_BUNDLE_IDENTIFIER)而不是旧的$(BUNDLE_IDENTIFIER).

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

Apple 在 Xcode 7 发行说明中表示PRODUCT_BUNDLE_IDENTIFIER,现在是“为目标设置 Bundle Identifier 的推荐位置”。因此,如果您BUNDLE_IDENTIFIER在项目中使用其他任何地方,请务必将其更改为PRODUCT_BUNDLE_IDENTIFIER以保持同步。

回答by Paolo Marini

I was getting the same error - although in different conditions - and it took me a while to realise that I had inadvertently messed with the Info.plist (thank you user2866588!) via a Search & Replace operation.

我遇到了同样的错误 - 尽管在不同的条件下 - 我花了一段时间才意识到我通过搜索和替换操作无意中弄乱了 Info.plist(谢谢 user2866588!)。

Once fixed that file, the error went away. It's a long shot, but you never know...

一旦修复了该文件,错误就消失了。这是一个很长的镜头,但你永远不知道......

回答by MRizwan33

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 asthan Source Codehere just find this CFBundleURLSchemesbelow this name a string tag contains your bundle identifier) Copy Bundle identifier and past it on TARGETselect Generalnow on Identity you will see Bundle Identifierpaste there and enter. then just run the code. Happy Coding!!!

图片说明在这里.!! 我收到此错误,只需输入捆绑标识符。(您可以通过右键单击 info.plist 并转到Open asthan Source Code获取包标识符,只需在此名称下方找到此CFBundleURLSchemes一个字符串标记包含您的包标识符)复制包标识符并将其粘贴TARGET选择Generalnow on Identity你会看到捆绑标识符粘贴在那里并输入。然后只需运行代码。编码快乐!!!

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

回答by anoop4real

I got this error when my test phone had low memory (around 288MB free). After restart and clearing some cached data, I was able to install my app.

当我的测试手机内存不足(大约 288MB 可用空间)时,我收到此错误。重新启动并清除一些缓存数据后,我能够安装我的应用程序。

回答by David.Chu.ca

What I found is that info.plistfile 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.

我发现该info.plist文件不应该被本地化!我尝试本地化我的项目并尝试在所有 plist 和字符串文件上点击本地化。结果,我无法将我的应用程序安装到模拟器,无效参数错误。

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.

我花了 1.5 天试图找出原因。我尝试了上面列出的所有解决方案,但没有运气。最后,放弃我所有的本地化更改并重做。这一次,我尝试先本地化一个文件,然后编译代码并尝试在模拟器上运行我的应用程序。

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

问题是info.plist文件。你可以本地化它。结果是en版本被移动en.lproj文件夹。也就是说,项目文件夹中不再有 info.plist 文件。结果,Xcode 找不到它并引发异常。

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

验证它的另一种方法是检查您的项目设置。选择您的目标和常规选项卡。本Identity应该是这样的:

enter image description here

在此处输入图片说明

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

如果你的项目设置是这样的,你必须找到info.plist,这意味着info.plist丢失了。

enter image description here

在此处输入图片说明

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

您只是无法info.plist从项目设置中找到en.lproj 文件夹中的本地化。

enter image description here

在此处输入图片说明

Don't localize info.plistfile directly. You can localize it by localizing infoplist.stringsfile.

不要info.plist直接本地化文件。您可以通过本地化infoplist.strings文件来本地化它。

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

这可能是获得无效参数异常的原因之一,就像我的情况一样。

I also wrote a blog on this.

我也写了一篇关于这个的博客。

回答by palzarena

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.

我遇到了同样的问题,这是因为手机内存不足。我删除了一些应用程序并重新启动了可用存储带来的手机。