重新签名IOS .ipa文件 (包含第三方框架和插件)

本文未经测试,初步看代码流程接近本人想法,留下作记录。
Intoduction

This code allow you to resign your own ipa assuming that you have:
1) a developer certificate issued by apple and added to your keychain
2) a mobileprovision file

This code allow you to resign your app without using xcode or if you need to add a UDID for development distribution.
This code correctly signs ipas with Frameworks (.framework folders), Plugins (.appex folders), Applications (.app folders)
This code autoincludes entitlements with binaries extracting them from the provided mobileprovision file.

Usage

This code runs on mac osx
You should already have installed OSX Command Lines Tools
The code is a shell script

Step 1
Change the following variables inside the signall.sh script:

1

2

3

4

5

6

signscript="/path/to/sign.sh"

ipasourcefolder="path/to/ipas/source/folder"

ipadestfolder="/path/to/ipas/destinations/folder/"

developer1="iPhone Developer: xxxxx (xxxxx)"

mobileprovision1="/path/to/mobile/provision"

Step 2

1

2

3

make sure that ipasourcefolder and ipadestfolder are writable

run signall.sh via terminal

done

In your destination folder you will have all your ipas signed.

Source and Updates

https://bitbucket.org/xgiovio/ios-ipa-resign/src

Code
signall.sh

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

# !/bin/bash

signscript="/path/to/sign.sh"

ipasourcefolder="path/to/ipas/source/folder"

ipadestfolder="/path/to/ipas/destinations/folder/"

developer1="iPhone Developer: xxxxx (xxxxx)"

mobileprovision1="/path/to/mobile/provision"

cd $ipasourcefolder

find -d . -type f -name "*.ipa"> files.txt

while IFS=‘‘ read -r line || [[ -n "$line" ]]; do

filename=$(basename "$line" .ipa)

echo "Ipa: $filename"

#_dev1_______

output=$ipadestfolder$filename

output+="_signed_dev1.ipa"

"$signscript" "$line" "$developer1" "$mobileprovision1" "$output"

done < files.txt

rm files.txt

sign.sh

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

# !/bin/bash

SOURCEIPA="$1"

DEVELOPER="$2"

MOBILEPROV="$3"

TARGET="$4"

unzip -qo "$SOURCEIPA" -d extracted

APPLICATION=$(ls extracted/Payload/)

cp "$MOBILEPROV" "extracted/Payload/$APPLICATION/embedded.mobileprovision"

echo "Resigning with certificate: $DEVELOPER" >&2

find -d extracted  \( -name "*.app" -o -name "*.appex" -o -name "*.framework" -o -name "*.dylib" \) > directories.txt

security cms -D -i "extracted/Payload/$APPLICATION/embedded.mobileprovision" > t_entitlements_full.plist

/usr/libexec/PlistBuddy -x -c ‘Print:Entitlements‘ t_entitlements_full.plist > t_entitlements.plist

#/usr/libexec/PlistBuddy -c ‘Print:application-identifier‘ t_entitlements.plist > t_entitlements_application-identifier   #save developer application-identifier to file

#/usr/libexec/PlistBuddy -c ‘Print:com.apple.developer.team-identifier‘ t_entitlements.plist > t_entitlements_com.apple.developer.team-identifier  #save com.apple.developer.team-identifier application-identifier to file

while IFS=‘‘ read -r line || [[ -n "$line" ]]; do

#/usr/bin/codesign -d --entitlements :-  "$line" > t_entitlements_original.plist    #save original entitlements from the app

#/usr/libexec/PlistBuddy -x -c ‘Import application-identifier t_entitlements_application-identifier‘ t_entitlements_original.plist #overwrite application-identifier

#/usr/libexec/PlistBuddy -x -c ‘Import com.apple.developer.team-identifier t_entitlements_com.apple.developer.team-identifier‘ t_entitlements_original.plist #overwrite com.apple.developer.team-identifier

/usr/bin/codesign --continue -f -s "$DEVELOPER" --entitlements "t_entitlements.plist"  "$line"

done < directories.txt

echo "Creating the Signed IPA"

cd extracted

zip -qry ../extracted.ipa *

cd ..

mv extracted.ipa "$TARGET"

rm -rf "extracted"

rm directories.txt

rm t_entitlements.plist

rm t_entitlements_full.plist

#rm t_entitlements_original.plist

#rm t_entitlements_application-identifier

#rm t_entitlements_com.apple.developer.team-identifier

时间: 2024-07-28 13:58:57

重新签名IOS .ipa文件 (包含第三方框架和插件)的相关文章

iOS开发之常用第三方框架(下载地址,使用方法,总结)

iOS开发之常用第三方框架(下载地址,使用方法,总结) 说句实话,自学了这么久iOS,如果说我不知道的但是又基本上都摸遍了iOS相关知识,但是每次做项目的时候,遇到难一点的地方或者没试过的东西就闷了. 比如这次,打算做一个着手做一个iOS的项目,是一个关于日计划的小软件,界面都其他的都算满意,网络就不说了,没有服务器,所以很多数据相关的功能不无法实现. 但是嘴头疼的事情就是,比如遇到一个功能的时候,其实如果说要实现的话还是可以的,但是每次在我实现之后我总会想到,这么实现更好,这么实现更简单,更加

IOS一些高效的第三方框架库

MBProgressHUD ——进展指示符库 苹果的应用程序一般都会用一种优雅的,半透明的进度显示效果,不过这个API是不公开的,因此你要是用了,很可能被清除出AppStore.而 MBProgressHUD提供了一个替代方案,而且在用户角度上,实现的效果根本看不出和官方程序有什么差别.同时还提供了其他附加功能,比如虚拟进展 指示符,以及完成提示信息.整合到项目里也很容易,这里不细谈了. ASIHttpRequest ——HTTP Network库 iPhone当然也有自己的HTTP Netwo

iOS .ipa文件的生成与使用

如果想要将做的iOS应用程序装到自己的iOS设备上测试.或者装在别人的iOS设备上,或者想发布到App Store里,先要给应用签名.签名就要有证书,这就需要申请证书的过程了. 把自己的应用程序装到设备中,主要有以下几种方式: ① 把iOS设备与电脑连起来,这样在Xcode的左上角就可以选择这个设备,之后直接点击Run,程序就被装在这个iOS设备了.这个主要用于在真机上测试程序.前提是Xcode中添加了包含这个设备信息的Profile. ② 使用Xcode将应用程序以Ad Hoc方式打包,导出i

iOS学习之常用第三方框架总结(经典/必看)

写iOS 程序的时候往往需要很多第三方框架的支持,可以大大减少工作量,讲重点放在软件本身的逻辑实现上. GitHub 里面有大量优秀的第三方框架,而且 License 对商业很友好.一下摘录一下几乎每个项目都想集成的几个框架. SDWebImageView 1. Mantle Mantle 让我们能简化 Cocoa 和 Cocoa Touch 应用的 model 层.简单点说,程序中经常要进行网络请求,请求到得一般是 json 字符串,我们一般会建一个 Model 类来存放这些数据.这就要求我们

iOS开发之包含官方框架

1.点击项目名称 2.在中间编辑栏,先在上面选择General,然后在下面找到Linked Frameworks and Libraries,最后添加要用到的框架即可 3.最后在需要用该框架的视图控制器的.m或者.h文件中包含该框架的头文件即可

iOS:网络编程的第三方框架:AFNetworking、SDWebImage

网络编程第三方框架:AFNetworking.SDWebImage 介绍:这些框架是开源的,经过前人的封装.改进,成为使用次数很多的一个性能好的源代码框架,只需要将它导入项目中,就可以使用.因此,在做项目时,使用它能够大大地提高效率. ※ 一.AFNetworking:功能是用来下载网络数据(包括文件,图片等) 属性如下: ※NSURLConnection: AFURLConnectionOperation AFHTTPRequestOperation AFHTTPRequestOperatio

提高iOS开发效率的第三方框架等--不断更新中。。。

1. Mantle Mantle 让我们能简化 Cocoa 和 Cocoa Touch 应用的 model 层.简单点说,程序中经常要进行网络请求,请求到得一般是 json 字符串,我们一般会建一个 Model 类来存放这些数据.这就要求我们编写一系列的序列化代码,来把 json 转换为 Model .这很费时间,容易错,不容易修改. Mantle 很好的解决了这个问题,而且更易用. GitHub : https://github.com/Mantle/Mantle 参考: 工具篇: Mantl

如何使用Shell脚本编译生成Archive文件并导出签名IPA文件。

1. build 脚本说明 本Shell脚本用于build,XCode的workspace源代码工程,并导出成可重签名的IPA文件,用于分发测试安装文件和用于提交appstore审核的文件.实现辅助产品开发,测试的配置管理工作. 使用本脚本需要以下环境 - Mac OS 10.9+ - XCode 6.0 or later and command line tools - 用于WorkSpace工程,例如使用了Cocoapods依赖库管理的工程 - *配置好开发证书和ad ho 证书(for D

无需苹果企业证书签名,IPA证书签名,ios证书签名,不用签名证书将网页封装成苹果描述文件

有什么办法能无需苹果企业签名,无需IPA证书签名,无需ios签名证书就能将网页生成苹果描述文件(此方法只支持网站封装描述文件生成,原生的用不了) 近期很多朋友想把网站变成app的方法,原因很多种,有的是灰色的网站产品不能用网页展示,有的是觉得网页太low想开发个app显得高的上. 其实网站变成app很简单,只需要您的网站是H5自适应的或者网站支持手机端访问,就可以,直接封装成APP发布出去. 封装打包生成app是很简单的,网上一堆生成描述文件工具,打包服务网站分分钟可以完成.价格也就是几百块钱.