「Objective-C」NSBundleクラスのサンプル

説明
– (NSString *)bundlePath  バンドルのパスを取得
– (NSString *)bundleIdentifier バンドルIDを取得

使用例
// バンドルを取得
NSBundle *nsBundle = [NSBundle mainBundle];
// バンドルのパスを取得
NSString *path = [nsBundle bundlePath];
// バンドルのIDを取得
NSString *nsBid = [nsBundle bundleIdentifier];
// バンドルの情報を取得してNSLogで出力します
NSDictionary *cft = [nsBundle infoDictionary];
NSArray *keys = [cft allKeys];
NSArray *vals = [cft allValues];
for(int n=0;n<[keys count];n++){
NSLog(@"キー:%@ 値:%@", [keys objectAtIndex:n], [vals objectAtIndex:n]);
}

Objective-C

Posted by arkgame