rsanchezsaez / CardboardSDK-iOS

iOS port of Google's CardboardSDK (mobile VR toolkit)
Other
334 stars 104 forks source link

Designated Initializer to use CDBViewController via Storyboard #16

Closed kgoedecke closed 8 years ago

kgoedecke commented 8 years ago

Hello,

the CDBViewController currently only implements the init designated initializer. Storyboard uses initWithCoder as designated initializer. When I'm trying to copy & paste the code from the init method it only shows a black screen.

I ended up solving the problem like this: https://github.com/kgoedecke/CardboardSDK-iOS/commit/bd29578db0ea717d0183529d3a46778c9b9945e8

Whats the proper way to run the init code from initWithCoder?

rsanchezsaez commented 8 years ago

Hi,

thanks for spotting this and submitting a possible fix. What you did is almost going in the right direction but it's not completely right.

I pushed commit 0b7cd10 to master in an attempt to fix this. Can you try with this change and see if it resolves?

If the aforementioned commit doesn't work, it'd be great if you can upload a small example using CardboardSDK-iOS from a Storyboard to GitHub so I can have a look and fix it properly (the proper solution would be to move CBDViewController's init code to a helper sharedInit method which would then be called both from initWithNibName:bundle: and initWithCoder:).

rsanchezsaez commented 8 years ago

Fix merged, thanks.