热更新--动态加载framework
生活随笔
收集整理的這篇文章主要介紹了
热更新--动态加载framework
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.準備工作:先自己封裝一個framework:http://www.cnblogs.com/sunjianfei/p/5781863.html
2.把封裝好的framework壓縮成zip,放到本地服務器端
3.下載壓縮包,并且解壓,參照:http://www.cnblogs.com/sunjianfei/p/5781799.html
4.添加并設置Application requires iPhone env。。。。。為yes
5.動態加載下載下來的framework庫文件:
NSString *documentDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];NSString *bundlePath = [NSString stringWithFormat:@"%@/%@",documentDirectory,@"JFTestFramework.framework"];NSLog(@"2-------%@",bundlePath);if (![[NSFileManager defaultManager] fileExistsAtPath:bundlePath]) {NSLog(@"file not exist");return;}NSBundle *bundle = [NSBundle bundleWithPath:bundlePath];if (!bundle || ![bundle load]) {NSLog(@"bundle load error");}Class loadClass= [bundle classNamed:@"JFDylib"];if (!loadClass) {NSLog(@"get bundle class fail");return;}NSObject *bundleObj = [loadClass new];[bundleObj performSelector:@selector(showViewAfterVC: inBundle:) withObject:self withObject:bundle];?
轉載于:https://www.cnblogs.com/sunjianfei/p/5781900.html
總結
以上是生活随笔為你收集整理的热更新--动态加载framework的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 点击切换图标方法,jquery boot
- 下一篇: XCode 项目配置说明