简体   繁体   中英

embed .caf into a static library .a is it possible?

I am able to play a .caf or an .mp3 file when I place it as a resource inside my project. like below.

NSString *mp3Path = [[NSBundle mainBundle] pathForResource:@"beep" ofType:@"caf"];
NSURL *mp3Url = [NSURL fileURLWithPath:mp3Path];
_player = [[AVAudioPlayer alloc] initWithContentsOfURL:mp3Url error:nil];
_player.numberOfLoops = 8;

[_player play];

But for some reasons, I need to generate a static library .a from my project and wish to embed this .caf or .mp3 file inside the .a library.

is it possible at all? if it is, could you tell me how? because I couldn't find any sample doing a similar thing online.

It's not usual to include resources in a static library. Usually they are included in a .bundle file. You can generate a framework that contains the static .a library, the bundle file and headers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM