开发者

How do you get the directory parameter of pathsForResourcesOfType:inDirectory:?

开发者 https://www.devze.com 2023-02-18 08:26 出处:网络
In my Resources group in XCode I have a subgroup called \"AUDIO\", and a subgroup of that called \"words_audio\".I have a bunch of sound files I\'m trying to get the paths of.I tried

In my Resources group in XCode I have a subgroup called "AUDIO", and a subgroup of that called "words_audio". I have a bunch of sound files I'm trying to get the paths of. I tried

NSArray *pathsForWordAudio = [NSBundle pathsForResourcesOfType:@"mp3" inDirectory:@"words_audio"];

as well as a few other string parameters, but none of them work. The hierarchy setup of the folders in the directory is 开发者_如何学JAVAthe same as the setup of the group in XCode.


Basically, when you create a group in XCode - no corresponding folder is created. Moreover, result app bundle for iOS contains no folders at all (except system-dependent like "_CodeSignature" and localizations - "*.lproj"). So pass nil as directory parameter.


NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];

Code lifted from this SO thread.

0

精彩评论

暂无评论...
验证码 换一张
取 消