objective c - how to get INFOPLIST_FILE name iOS -


each target in project has has different info.plist. want name programmatically buildsettings> packaging> info.plist file somehow cant retrieve plist list filename. there way can retrieve plist programmatically?

nsbundle.mainbundle().objectforinfodictionarykey("cfbundleinfoplisturl") 

only gives me

info.plist -- file:///users/xxxx/library/developer/coresimulator/devices/xxxxxx-9b37-4c3d-88e9-xxxxx62b470/data/containers/bundle/application/7xxxxxxxb-be36-4d3e-9c90-xxxxx/project%20kol.app/ 

enter image description here

actually nsbundle.mainbundle().objectforinfodictionarykey("cfbundleinfoplisturl") returns nsurl object. extract absolutestring give name of plist file. check code below. sorry giving answer in objective-c don't know swift

nsdictionary *infodict = [nsbundle mainbundle].infodictionary; nsstring *plistfilepath = [[infodict objectforkey:@"cfbundleinfoplisturl"] absolutestring]; nsstring *plistfilename = [[plistfilepath componentsseparatedbystring:@"/"] lastobject]; 

plistfilename required file name (with extension .plist)


Comments

Popular posts from this blog

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

matlab - error with cyclic autocorrelation function -

php - Using grpc in Laravel, "Class 'Grpc\ChannelCredentials' not found." -