[英]Using TagLib (C++ Library) in Objective-C Mac App
I'm looking to use TagLib , a C++ library for getting tagging information from a variety of audio files, in a new Objective-C project. 我正在寻找在新的Objective-C项目中使用TagLib (一个C ++库,用于从各种音频文件中获取标记信息)的方法。
Also... is TagLib even a good choice? 另外... TagLib还是一个不错的选择吗? I need to support MP3, WMA, FLAC, MP4, M4A, AAC, and OGG files. 我需要支持MP3,WMA,FLAC,MP4,M4A,AAC和OGG文件。 I don't believe there is a native Mac framework that will support all of these. 我不相信有一个支持所有这些功能的本地Mac框架。
Thank you! 谢谢!
It is very easy to mix Objective-C and C++; 混合使用Objective-C和C ++非常容易; there is practically no problem. 几乎没有问题。 Read this documentation at Apple. 在Apple上阅读此文档。 As described there, there is something called Objective-C++, which allows you to mix C++ and Objective-C++ in the same file. 如此处所述,有一个叫做Objective-C ++的东西,它允许您在同一文件中混合使用C ++和Objective-C ++。 In XCode, just use a file extension .mm
to use Objective-C++. 在XCode中,只需使用文件扩展名.mm
即可使用Objective-C ++。
It does not attempt to unify at all the Objective-C objects and C++ objects; 它并不试图将所有的Objective-C对象和C ++对象统一起来。 you can just use them simultaneously, independently. 您可以同时独立地同时使用它们。 So the Objective-C objects are managed by retain
/ release
, and C++ objects are managed by new
/ delete
. 因此,Objective-C对象由retain
/ release
管理,而C ++对象则由new
/ delete
管理。 There are a few tricky things like putting a non-pointer C++ object as an ivar inside an Objective-C class, but if you always use C++ pointers (instead of non-pointer objects) you won't face any major problem. 有一些棘手的事情,例如将非指针C ++对象作为ivar放入Objective-C类中,但是如果您始终使用C ++指针(而不是非指针对象),您将不会遇到任何重大问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.