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