Mac Mac - 1 year ago 98
Swift Question

"Ambiguous Reference To" Error in Swift 3

Good Afternoon,

Im attempting to code a Music Play Application in which I am trying to implement some Open Source Code entitled "STK Audio Player" which is coded in Objective C.

When attempting to call a Method from the imported Source, I receive the following compile error.

"Ambiguous Reference To Member Play"

import UIKit

class ViewController: UIViewController {

var audioPlayer = STKAudioPlayer()

override func viewDidLoad() {
// Do any additional setup after loading the view, typically from a nib.

let songToPlay:String = ""

override func didReceiveMemoryWarning() {
// Dispose of any resources that can be recreated.


From The Open Source

/// Plays an item from the given URL string (all pending queued items are removed).
/// The NSString is used as the queue item ID
-(void) play:(NSString*)urlString;

Answer Source

play is an instance (-) method, so use the instance:

and do not annotate literal strings as String. Everybody including the compiler can see what it is.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download