xcode 为什么我在尝试安装 Ad-Hoc 版本时会收到“无法添加到您的 iTunes 库,因为它不是有效的应用程序”错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7570644/
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-09-14 22:02:43  来源:igfitidea点击:

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?

iphoneiosxcodexcode4

提问by Danny Tuppeny

I've recently upgraded my Mac to Lion, and also Xcode 4.

我最近将我的 Mac 升级到 Lion,还有 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).

在 Build Settings 中,我将“Release”的“Code Signing”设置为“iPhone Distribution”,它与我们的 Ad-Hoc 配置文件(我们过去在 Snow Leopard/Xcode 3 上使用过)相匹配。

I have deleted the old Entitlements file (as it's apparently no longer used by Xcode 4).

我已经删除了旧的 Entitlements 文件(因为它显然不再被 Xcode 4 使用)。

In the Scheme section, I've set Archive to use the Release build.

在 Scheme 部分,我已将 Archive 设置为使用 Release 版本。

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.

我通过进入管理器并单击共享来保存文件,然后确保选择了相同的 Ad-Hoc 配置。

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".

我将生成的 IPA 文件发送给我的老板,他以前安装过这个应用程序。当他尝试安装它时,他收到消息“无法将 [appname] 添加到您的 iTunes 库,因为它不是一个有效的应用程序”。

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.

我一直在尝试我能想到的每一种设置组合,但我们就是无法让它发挥作用。我只能在 Google 中找到两次此错误 - 一次来自手机越狱的人,另一次发布在文章的评论中,有人遇到同样的问题,但没有回应。

Any help would be really appreciated.

任何帮助将非常感激。

Edit: Same thing happens trying to drag the IPA into iTunes on the Mac that created it! :(

编辑:尝试将 IPA 拖入创建它的 Mac 上的 iTunes 时也会发生同样的事情!:(

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!

Edit2:刚刚采取了另一个(几乎相同的)项目并尝试了一个没有“现代化”项目的构建,或者选择了 Xcode 中的任何新选项(图标、启动图像、方向等),并且这个构建有效。我将通过这个应用程序完成我对原始应用程序所做的每一件事,并在每一步进行测试。希望应该能够隔离哪个步骤破坏了编译的应用程序!

(also posted to Apple Dev Forums)

(也发布到Apple Dev Forums

回答by Danny Tuppeny

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.

但是,经过多次清理/重启/等操作后,我相信这与目标设置中的“Build”版本有关(现在有两个版本字段,“Version”和“Build”)。似乎如果“Build”为空,则会发生此错误。

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.

该值作为 CFBundleVersion 写入 plist 文件。

回答by Roberto

Recently I suffered a problem with an Ad-Hoc installation using TestFlight service, the message in the log didn't help too much:

最近我在使用 TestFlight 服务进行 Ad-Hoc 安装时遇到了问题,日志中的消息没有太大帮助:

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 ;-)

因此,如果其他人在 TestFlight 上遇到此问题,我希望我的回答能让您更轻松地找到此页面 ;-)

回答by Kirti Nikam

I also faced the same issue. After doing some research found below answers as:

我也面临同样的问题。在做了一些研究后发现以下答案:

  • App Versionand Build versionshould not blank.
  • Don't put special characters in my app bundle name.
  • And also there was no issues with my provisioning profiles.
  • 应用程序VersionBuild version不应该的空白。
  • 不要在我的应用程序包名称中添加特殊字符。
  • 而且我的配置文件也没有问题。

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'.

调试后发现我的方案名和info.plist文件名存在名称不匹配。在我的项目中,我有 3 个方案,如 a、b、c,只有一个 a-info.plist 文件。我正在为“b”等不同的方案创建 IPA。

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).

在您的场景中,如果您创建了多个方案,请检查您的 Info.plist 名称。这应该与您的方案名称相同(您正在为其创建 IPA)。

Example. The scheme name is 'myScheme' then your Info.plist file name as 'myScheme-Info.plist'.

例子。方案名称为“myScheme”,然后您的 Info.plist 文件名称为“myScheme-Info.plist”。

Hope this will help you.

希望这会帮助你。

回答by Derek Knight

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...

我收到了相同的消息(“不是有效的应用程序”)。就我而言,我将构建的应用程序通过 FTP 传输到 Web 服务器,然后我就可以 OTA 配置它。我在放置文件之前没有切换到二进制模式,所以 .ipa 文件在途中损坏了。花了我大部分时间才弄清楚那个愚蠢的错误......

回答by Santosh

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.

我在尝试为旧项目(一年前由前开发人员构建)中的一个临时分发创建 .ipa 时遇到了类似的问题。在谷歌进行了大量研究并遵循上述解决方案后,由于某种原因,它对我不起作用。

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.

稍后在点击此链接后 -此处。通过用现有的工作项目(显然 - 相关图标/包显示名称/标识符)替换 .plist 文件并使用当前的 .plist 名称重命名。它对我有用。

I literally spent about 3-4 hours to fix this issue. Hope it helps some one.

我真的花了大约 3-4 个小时来解决这个问题。希望它可以帮助某人。

environment was native - iOS app.

环境是原生的 - iOS 应用程序。

回答by Umair Malik

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

在您的 info.plist 中添加......“应用程序需要 iPhone 环境”,或者如果添加了它的值“是”。检查“构建”和“版本”一般不为空......希望这会奏效

回答by Krishnan

Importing the project contents in to a new Project solved the issue for me.

将项目内容导入新项目为我解决了这个问题。

回答by anders

For me, we were trying to do an enterprise build of a very old app, from iOS 5.

对我来说,我们试图从 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.

在确认配置文件和其他一切正常后,调试版本正常工作,我注意到普遍的共识是关于 info.plist 文件的问题。

I compared the info.plist with another app and sure enough,

我将 info.plist 与另一个应用程序进行了比较,果然,

Application requires iPhone environment = NO

Basically this key needs to always be set to YESfor iOS apps regardless whether its for iPhone, iTouch or iPad...

基本上,对于 iOS 应用程序,无论是 iPhone、iTouch 还是 iPad,这个键都需要始终设置为YES...

It may not be limited to that key for everyone but make sure the info.plist looks similar to working apps.

它可能不仅限于每个人都使用该密钥,但要确保 info.plist 看起来类似于工作应用程序。

Bundle version
Bundle versions string, short

should always be present!

应该一直存在!

回答by Dennis

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

好的.. 做一件事.. 打开 info.plist.. 转到包标识符并更改包标识符名称。它需要是唯一的......像“com.yourcompany.projectname”之类的东西并创建并尝试安装ipa..它应该可以工作

回答by emrys57

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:

我有一个特别的应用程序,开发团队中的每个人都可以正常安装,除了一个人,他从 iTunes 收到错误:

X is not a valid app

X 不是有效的应用程序

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.

他已经能够安装这个应用程序的早期版本。重建app,改版本号,改build号都没有效果,他还是不能安装,别人可以。

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.

我通过创建一个全新的 Xcode 项目来修复它,要么复制文件,要么将文件的内容从旧项目复制并粘贴到新项目,然后重建应用程序并以与旧项目完全相同的方式对其进行签名。有效。