allowing NSBundle.mainBundle() in swift iOS app to find "der" format certificate files

2.3k Views Asked by At

I am extremely new to Swift iOS programming in xcode. For whatever reason, my NSBundle.mainBundle() is able to find image files in the code base,

var path = NSURL(fileURLWithPath: NSBundle.mainBundle()
     .pathForResource("icon", ofType: "png")!)

returns a non-nil string.

However, I have a "DER" format public CA certificate in the same directory.

path = NSURL(fileURLWithPath: NSBundle.mainBundle()
    .pathForResource("cacer", ofType: "der")!)

returns nil.

Any advice to give? Any extra information needed?

1

There are 1 best solutions below

1
On

Looks like cancer.der isn't referenced to app target.
Make sure that checkbox is on for that file:
screenshot