Question

I need convert M4A files to MP3 and i guess this link is the answer : ios - convert .m4a to .mp3 file programmatically.

I was searching , how use LAME on iOS? and i find this : https://gist.github.com/Superbil/7689556.

Once i execute, "build_ios.sh" 4 files are generated:

  • libmp3lame-armv7.a
  • libmp3lame-armv7s.a
  • libmp3lame-i686.a
  • libmp3lame.a

I understand the first two, are the libs that i need , for use this code :

ios - convert .m4a to .mp3 file programmatically.

How i can add this statics libraries to XCode and import for use the code?

I'm using the version 5.1.

Thanks in advance.

Was it helpful?

Solution

When using a static library, you need 2 things:

  • The static library itself (.a)
  • Header files to access its public interface

In the list of libraries you've posted, it would seem libmp3lame.a is the one you require. The three listed above it are for individual architectures, whereas the last one is a 'fat library', which is a collection of the individual architecture libraries. You can confirm this by running lipo on the fat library:

lipo -info libmp3lame.a

In order to incorporate it within your application, you need to:

  1. Add the .a and header files to your project (with the application being the intended target)

  2. Add the library to the "Link binary with libraries" build phase, found under 'Build Phases' for your target, within the Project settings

    Build Phases - Link binary with libraries

  3. Import/include the header files where you wish to use LAME

Ideally, it's worth having 2 sets of fat libraries; one for the simulator, and the other for the device. You can then include the appropriate one for the respective build target. This ensures the size of the application is the lowest it can be, but it's fairly harmless to include the simulator library within an App Store binary (it doesn't cause side effects).

Your question doesn't mention header files, and I don't see any reference within the build script as part of the build artefacts. You may need to copy the ones you require from the source itself into the project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top