Reputation: 425
I am trying to build a swift project using the HERE iOS Premium SDK. After a lot of trying I was able to "successfully" bridge the obj-c HERE iOS Premium SDK to my Swift project. My project compiles and builds but fails to initialize the map view at run time. I set up my keys in the app delegate:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
NMAApplicationContext.setAppId(kHelloMapAppID, appCode: kHelloMapAppCode, licenseKey: kHelloMapLicenseKey)
return true
}
I have a view controller with an IBOutlet of NMAMapView type:
@IBOutlet weak var mapView: NMAMapView!
override func viewDidLoad() {
super.viewDidLoad()
let coordinates: NMAGeoCoordinates = NMAGeoCoordinates(latitude: 37.33233141, longitude: -122.0312186)
mapView.setGeoCenter(coordinates, withAnimation: .Rocket)
mapView.zoomLevel = 13.2
mapView.copyrightLogoPosition = NMALayoutPosition.BottomCenter
}
When I try to run the app it compiles and builds but when the view controller is used I get the following error message
2015-12-02 22:34:31.045 BridgedHEREMapsSDK[1162:25254] Failed to set up map cache
2015-12-02 22:34:31.046 BridgedHEREMapsSDK[1162:25254] *** NMAKit WARNING: Error: NMAMapView initialization failed
My view still loads but does not show the map. Also, the code from inside my viewDidLoad method runs after the error is printed. Whatever the is seems to happen when creating the outlet:
@IBOutlet weak var mapView: NMAMapView!
Any ideas would be appreciated. Thank you.
***** EDIT *****
I created a brand new project included core data functionality in my project and it seems to be working now.
Upvotes: 1
Views: 1293
Reputation: 8626
Objective-C and Swift in the Same Project
MyApp-Bridging-Header.h
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import <NMAKit/NMAKit.h>
Upvotes: 0
Reputation: 425
This was solved by adding core functionality to the project (see my edit to the original question)
Upvotes: 0
Reputation: 2291
You have to add the NMABundle.bundle in your "Copy Bundle Resources" in "Build Phases".
NMABundle.bundle is in this path: NMAKit.framework/Versions/A/Resources/NMABundle.bundle
Upvotes: 1