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

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -