Almazini Almazini - 1 year ago 120
iOS Question

NSBundle cant find my plist file

I dont't know why in one of my project, program can find

file without any problem and in another file it returns nil.

It drives me crazy.

let path = NSBundle.mainBundle().pathForResource("poi", ofType: "plist")

enter image description here

you can see in debugger that this variable is nil

please help

Answer Source

I believe is not included in the Copy Bundle Resources. Did you check that? I notice that sometime drag and drop files wasn't automatically included.

I tested it that it work when is in the Copy Bundle Resources and it return nil if it wasn't included but still is a file in the project.

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download