簡體   English   中英

將.caf嵌入到靜態庫中。

[英]embed .caf into a static library .a is it possible?

將項目作為資源放置在項目中時,我可以播放.caf或.mp3文件。 像下面

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

但是由於某些原因,我需要從我的項目中生成一個靜態庫.a,並希望將此.caf或.mp3文件嵌入.a庫中。

有可能嗎? 如果是,您能告訴我如何嗎? 因為我找不到任何樣本在網上做類似的事情。

通常不會在靜態庫中包含資源。 通常它們包含在.bundle文件中。 您可以生成一個包含靜態.a庫,捆綁文件和標頭的framework

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM