惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
Latest news
Latest news
N
News | PayPal Newsroom
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Securelist
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
Cisco Talos Blog
Cisco Talos Blog
云风的 BLOG
云风的 BLOG
AWS News Blog
AWS News Blog
GbyAI
GbyAI
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
美团技术团队
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
博客园 - 聂微东
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
SecWiki News
SecWiki News
S
Secure Thoughts
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
腾讯CDC
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed

博客园 - Ethan_村长

自己开发iOS版按键精灵--TTouch iOS 基于OpenCV图像比较的常见方法 iOS越狱系统使用root权限运行命令 Mac CEF 支持mp3 mp4编译 iOS自动化测试需求实现(iOS按键精灵类似) [转]runtime 消息机制 [转]多线程 Mac读取Andriod屏幕截图 解决读取iphone名称中文乱码问题 windows或mac上对iOS设备截图 JPEG文件结构 ios获取左右眼图片景深图 使用libjpeg.framework压缩UIImage shell脚本删除指定mobileprovision iphone使用mac上的SOCKS代理 eclipse配置javah命令 [转]Android通过NDK调用JNI,使用opencv做本地c++代码开发配置方法 利用JNI技术在Android中调用、调试C++代码 CocoaPods pod install
iOS在线更新framework,使用NSBundle动态读取
Ethan_村长 · 2015-04-20 · via 博客园 - Ethan_村长

官方文档:https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/LoadingCode/Tasks/LoadingBundles.html

framework制作:http://www.cocoachina.com/ios/20141126/10322.html

1.framework代码:framework一定要打包为动态库

@implementation TestView
-(id)initWithFrame:(CGRect)frame
{
    if (self=[super initWithFrame:frame])
    {
        UIButton *btn=[[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
        [btn setBackgroundColor:[UIColor redColor]];
        [self addSubview:btn];
    }
    return self;
}
@end

2.将制作好的framework直接压缩成zip包FrameWorkOne.framework.zip,然后上传到服务器

3.在iOS程序中下载zip并解压缩

4.NSBundle load解压缩的framework动态直接代码

 NSString* bundlefile = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/FrameWorkOne.framework"];
     NSBundle *frameworkBundle = [NSBundle bundleWithPath:bundlefile];
    if (frameworkBundle && [frameworkBundle load]) {
        NSLog(@"bundle load framework success.");
    }else {
        NSLog(@"bundle load framework err");

        return;
    }
    
    Class pacteraClass = NSClassFromString(@"TestView");
    if (!pacteraClass) {
        NSLog(@"Unable to get TestDylib class");

        return;
    }
    
    UIView *v=[[pacteraClass alloc] initWithFrame:self.view.bounds];
    [self.view addSubview:v];
    [self.view sendSubviewToBack:v];

    
    [frameworkBundle unload];