The Simulator does not have a camera!
Only real device have cameras.
Your code may well be fine.
Try running it on a real iPhone or iPad, and see if it works.
Note: Your code checks "isSourceTypeAvailable(camera)", but you don't take any action if the sourceType is not available.
If you (for example) logged an error message to the console, then you would have noticed that your app was not detecting a camera.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: