iphone – NSDirectoryEnumerator和子文件夹

iphone – NSDirectoryEnumerator和子文件夹,第1张

概述我有一个iPhone应用程序搜索文件夹,整理所有音频文件的数组,并让他们回放.问题是,如果我正在搜索的文件夹中有一个子文件夹,它将跳过它/不进入其内容. 我的代码如下: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *docume 我有一个iPhone应用程序搜索文件夹,整理所有音频文件的数组,并让他们回放.问题是,如果我正在搜索的文件夹中有一个子文件夹,它将跳过它/不进入其内容.

我的代码如下:

NSArray *paths = NSSearchPathForDirectorIEsInDomains(NSdocumentDirectory,NSUserDomainMask,YES); Nsstring *documentsDirectory = [paths objectAtIndex:0]; NSDirectoryEnumerator *direnum = [[NSfileManager defaultManager] enumeratorAtPath:documentsDirectory]; Nsstring *pname; while (pname = [direnum nextObject]){      [musicArray addobject:[pname stringByDeletingPathExtension]];}

我想要做的是继续搜索其子文件夹,我将如何去做?

解决方法 它自动完成. From the documentation:

An enumeration is recursive,including the files of all subdirectorIEs,and crosses device boundarIEs. An enumeration does not resolve symbolic links,or attempt to traverse symbolic links that point to directorIEs.

总结

以上是内存溢出为你收集整理的iphone – NSDirectoryEnumerator和子文件夹全部内容,希望文章能够帮你解决iphone – NSDirectoryEnumerator和子文件夹所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1018304.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存