关于 iPhone/iPad 放弃构建行为的非常棘手的问题

发布于 2024-11-10 06:46:12 字数 418 浏览 5 评论 0原文

事情是这样的..

场景:

我得到了一个 ipa 文件,这是存档 + 共享过程的结果 使用 XCode。 ipa 文件使用临时分发证书进行签名,并且 它可以毫无问题地安装。

应用程序在钥匙串中保存一些信息 使用我刚刚制作的构建可以毫无问题地访问它。

之后,我使用 Enterprise 的 codesign 命令重新签署应用程序 在 applicaction.app 包中进行一些更改后的分发证书。 此更改包括更改应用程序的名称和捆绑包 ID info.plist 文件,当然,将嵌入式移动配置文件替换为 与新证书相匹配的证书。

问题:

辞职后一切似乎都正常,安装和功能似乎工作正常......但是!当我输入信息时 保存在钥匙串中,数据似乎无法加载或擦除 每次我关闭应用程序时的钥匙串。

为什么会发生这种情况?

Here's the thing..

Scenario:

I got a ipa file which I get as a result of an Archive + Share process
using XCode. The ipa file is signed using ad hoc distribution certificates and
it can be installed without any problems.

The application saves some information in the keychain
which is accessed without any problems using the build I just made.

After that, I re-sign the application using the codesign command with Enterprise
distribution certificate after making some changes in the applicaction.app package.
This changes includes changing the name of the application and bundle id from the
info.plist file, and of course, replace the embedded mobile provisioning profile with
the one that matches the new certificate.

The Problem:

After resigning every seems to be all right, installation and functionality seems to work ok.... BUT! when I enter the information
that is saved in the keychain, the data seems not to load or be wiped from
the keychain every time I close the app.

Ideas of why is this happening?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

残龙傲雪 2024-11-17 06:46:12

我已经搜索了几个小时来解决这个问题...这就是解决方案,应用程序辞职如何与我们的应用程序一起工作。我们从客户那里得到了一个 IPA 文件,并用我们的证书签署了它。访问钥匙串有效。在我们的例子中,bundle.id 没有改变。

您需要哪些文件:

  • MyApp.ipa
  • MyApp_EnterpriseDistribution.mobileprovision(企业分发配置配置文件)
  • Entitlements.plist

所有文件都位于同一目录中。如果文件位于不同的文件夹中,则必须更改代码中的路径

首先,我们创建一个“Entitlements.plist”。创建一个txt文件并放入以下代码。输入您的应用程序标识符。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>application-identifier</key>
    <string>GBA9L2EABG.com.your.bundle.id.MyApp</string>
    <key>get-task-allow</key>
    <false/>
</dict>
</plist>

保存此文件并将其重命名为:“Entitlements.plist”

打开终端,移动到该文件夹​​并执行此代码,将“MyApp”替换为您的应用程序名称,将“NAME OF YOUR...”替换为您的证书名称和“ MyApp_EnterpriseDistribution”添加到您的配置文件中:

unzip MyApp.ipa

//we didn't used the following, maybe necessary...
//rm -r "Payload/MyApp.app/_CodeSignature" "Payload/MyApp.app/CodeResources" 2> /dev/null | true

cp MyApp_EnterpriseDistribution.mobileprovision Payload/MyApp.app/embedded.mobileprovision

codesign -f -s "iPhone Distribution: NAME OF YOUR DISTRIBUTION CERTIFICATE" --resource-rules Payload/MyApp.app/ResourceRules.plist --entitlements Entitlements.plist  Payload/MyApp.app

zip -qr MyApp-resigned.ipa Payload/

现在您有了带有证书的 Ipa。

提示:具有此名称的证书在您的钥匙串中应该是唯一的...

I have searched hours for this problem... This is the solution, how the app resigning worked with our app. We got an IPA file from a customer and resigned it with our certificate. Accessing the Keychain works. The bundle.id was not changed in our case.

Which files you need:

  • MyApp.ipa
  • MyApp_EnterpriseDistribution.mobileprovision (Enterprise Distribution Provisioning Profil)
  • Entitlements.plist

All files are in the same directory. If the files were located in different folders, you have to change the path in the code

First, we create an "Entitlements.plist". Create a txt file and put in the following code. Put in your application identifier.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>application-identifier</key>
    <string>GBA9L2EABG.com.your.bundle.id.MyApp</string>
    <key>get-task-allow</key>
    <false/>
</dict>
</plist>

Save this file and rename it to: "Entitlements.plist"

Open the terminal, move to the folder and execute this codes, replace "MyApp" with your Appname and "NAME OF YOUR..." with the name of your certificate and "MyApp_EnterpriseDistribution" to your provisioning file:

unzip MyApp.ipa

//we didn't used the following, maybe necessary...
//rm -r "Payload/MyApp.app/_CodeSignature" "Payload/MyApp.app/CodeResources" 2> /dev/null | true

cp MyApp_EnterpriseDistribution.mobileprovision Payload/MyApp.app/embedded.mobileprovision

codesign -f -s "iPhone Distribution: NAME OF YOUR DISTRIBUTION CERTIFICATE" --resource-rules Payload/MyApp.app/ResourceRules.plist --entitlements Entitlements.plist  Payload/MyApp.app

zip -qr MyApp-resigned.ipa Payload/

And now you have an Ipa with your certificate.

hint: the certificate with this name should be unique in your keychain...

戈亓 2024-11-17 06:46:12

好的,这是对我们有用的解决方案。

由于这是企业版本,因此需要我们更改 Entitlements.plist/dist.plist 文件,以便应用程序 ID 与 Apple 网站上输入的内容相匹配。权利文件可以在协同设计实用程序上提供。

使用这些说明,但验证权利文件与完整的应用程序 ID 匹配。这包括种子 id + 捆绑包 id。

重新签名 IPA (iPhone)

如果没有它,应用程序也可以正常安装,但这可以确保密钥库正在以适当的权限进行访问。

Ok, here's the solution that worked for us.

Since this was an Enterprise build, it required us to change the Entitlements.plist/dist.plist file so that the app id matched what was entered on Apple's site. The Entitlements file can be provided on the codesign utility.

Use these instructions but verify the Entitlements file matches the full app id. This includes the seed id + bundle id.

Re-sign IPA (iPhone)

The app would install fine without it, but this ensures the keystore is being accessed with the proper authority.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文