0

I am trying to import an image into a Spritekit scene. Using Xcode version 8.2 (8C38) with Swift 3. The code below work fine in a single view application but not with Spritekit.

    class GameScene: SKScene, UIImagePickerControllerDelegate, UINavigationControllerDelegate

    let imagePickerController = UIImagePickerController()

    imagePickerController.sourceType = .photoLibrary

    imagePickerController.delegate = self

    present(viewController, animated: false, completion: nil)

getting the following error

    GameScene.swift:93:9: Use of unresolved identifier 'present'

cannot find 'present' under self or self.view either, i know in previous versions of swift we use to have presentViewController.

helix82
  • 35
  • 1
  • 6

1 Answers1

0

You can't invoke present on a GameScene object.

Instead you need to invoke present on a reference to GameViewController.

And you can find the instructions to retrieve a reference to your GameViewController here.

Community
  • 1
  • 1
Luca Angeletti
  • 58,465
  • 13
  • 121
  • 148