我需要获取应用程序的路径(bundlePath或bundleURL)而不使用应用程序名称
NSUrl *strUrl = [[NSBundle mainBundle]bundleURL];
NSString *str = [[NSBundel mainBundel]bundlePath];
我该怎么做
答案 0 :(得分:3)
NSURL
和NSString
都有删除最后一个路径组件的方法,因此这应该可以提供您想要的内容:
NSURL *strUrl = [[[NSBundle mainBundle] bundleURL] URLByDeletingLastPathComponent];
NSString *str = [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent];