Start a new topic

crash when set license key

Hello,


i have a trial key and i am working on ios with the swift. 

I have the latest wikitude SDK.


When application is opened, i have described a constant as -> let wikitudeSDK: WTWikitudeNativeSDK! = nil


So, when view did load -> self.wikitudeSDK.setLicenseKey("My Key")


But application goes to crash and say that "fatal error: unexpectedly found nil while unwrapping an Optional value".


I wonder that what the problem is.


Hello Furkan,

Do you still get a crash or is this issue associated with the one reported here?

Thanks
Eva

 

Hi Furkan,


The issue you're facing is that you've declared the `wikitudeSDK` variable but did not initialize it (`= nil`).

Typically, you initialize the wikitude SDK in your view controller, once it has loaded all its views.


You should change the `let wikitudeSDK` into`var wikitudeSDK` and in your viewcontroller's `viewDidLoad` initialize it:


```

self.wikitudeSDK = WTWikitudeNativeSDK(renderingConfiguration: ... , delegate: self)

```


Only after initialization you can set the license key.


The native code examples should also be able to help you further out I think.


Kind regards,

steven

Login or Signup to post a comment