如何在iPhone项目中使用Jar? [英] How Jar usage in iphone project?

查看:212
本文介绍了如何在iPhone项目中使用Jar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jar文件,我需要包含在我的xcode项目中,即iphone项目。怎么做&也请帮助我,然后如何在Objective-C代码中使用它,如在java中使用它:
system.out.println(Res:+ objA.connect(,)blahh ,blahhhhh)

I have a jar file , that i need to include in my xcode project i.e. iphone project. How to do it & also please help me, then how to use it in objective-C code, as in java its used like: system.out.println("Res:"+objA.connect("",""")blahh, blahhhhh)

感谢您的帮助!!!!!

Thanks for ur Help!!!!!

推荐答案

我假设你在jar文件中存储某种资源而你想要解压缩.jars是zip文件所以你需要一个unzipper,比如 https://github.com/samsoffes/ssziparchive

I'm assuming you are storing some kind of resource in your jar file and you want to extract it. Jars are zip files so you need an unzipper, like https://github.com/samsoffes/ssziparchive

[SSZipArchive unzipFileAtPath:path toDestination:destination];

http://code.google.com/p/ziparchive/

ZipArchive *zip = [[ZipArchive alloc] init];
if ( [zip UnzipOpenFile:path] ) {
    [zip UnzipFileTo:destination overWrite:YES];
}
[zip UnzipCloseFile];

两者都使用minizip实现心理状态。现在您需要目标路径:

Both use the minizip implementation. Now you need the destination path:

NSString *destination = NSTemporaryDirectory();

以及jar文件的路径:

and the path of your jar file:

NSString* path = [[NSBundle mainBundle].resourcePath stringByAppendingPathComponent:@"archive.jar"];

这篇关于如何在iPhone项目中使用Jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆