2016-08-15 2 views
2

Je veux lire les fichiers contenus dans le cadre info.plist ma propre création. Quand j'essaie de lire, les rferans ont lu son fichier info.plist.Lire info.plist dans un cadre personnalisé

J'ai besoin de lire les deux. Comment puis-je le faire? Pourriez-vous aider?

NSLog(@"*** %@", [[[NSBundle mainBundle] localizedInfoDictionary] valueForKey:@"ASD"]); 
NSLog(@"*** %@", [[[NSBundle mainBundle] infoDictionary] valueForKey:@"ASD"]); 
NSLog(@"*** %@", [[[[NSBundle allFrameworks] objectAtIndex:0] infoDictionary] valueForKey:@"ASD"]); 

Framework Screenshot

App Screenshot

+0

que vous devez obtenir cela avec le chemin comme ci-dessous: 'NSString * path = [[NSBundle mainBundle] pathForResource: @ "YOURPLISTNAME" ofType: @" plist "]; NSMutableDictionary * dictplist = [[NSMutableDictionary alloc] initWithContentsOfFile: chemin]; ' – CodeChanger

Répondre

3

d'abord créer ensemble en utilisant votre chemin-cadre:

NSString* mainBundlePath = [[NSBundle mainBundle] resourcePath]; 
NSString* frameworkBundlePath = [mainBundlePath stringByAppendingPathComponent:@"YourFrameworkBundle.bundle"]; 
frameworkBundle = [NSBundle bundleWithPath:frameworkBundlePath]; 

ensuite accéder à dictionnaire Info ou ce que vous voulez

1

Merci pour vos réponses .

Solution sont comme indiqué ci-dessous:

[[[NSBundle bundleForClass:[self class]] infoDictionary] objectForKey:@"ASD"]