Almazini Almazini - 4 months ago 22
iOS Question

NSBundle cant find my plist file

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

plist
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

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