Search code examples
iosxcodesoundcloud

SoundCloud iOS starting Tutorial - unrecognized selector


I am following the iOS quick start tutorial and I have gotten as far as creating the button to login to SoundCloud but I'm getting this error:

2013-05-01 15:00:44.698 SoundCloudSample[60999:c07] +[SCSoundCloud shared]: unrecognized selector sent to class 0x3a568
2013-05-01 15:00:44.701 SoundCloudSample[60999:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SCSoundCloud shared]: unrecognized selector sent to class 0x3a568'
*** First throw call stack:
(0x192a012 0x174fe7e 0x19b52ad 0x1919bbc 0x191994e 0x2ad0 0x17507cf 0x1757a0d 0x174eaeb 0x174ee22 0x17610e1 0x1763705 0x8c02c0 0x8c0258 0x981021 0x98157f 0x9806e8 0x8efcef 0x8eff02 0x8cdd4a 0x8bf698 0x1da7df9 0x1da7ad0 0x189fbf5 0x189f962 0x18d0bb6 0x18cff44 0x18cfe1b 0x1da67e3 0x1da6668 0x8bcffc 0x1f0d 0x1e35)
libc++abi.dylib: terminate called throwing an exception
(lldb) 
- (IBAction) login:(id)sender {

SCLoginViewControllerCompletionHandler handler = ^(NSError *error) {
    if (SC_CANCELED(error)) {
        NSLog(@"Canceled!");
    } else if (error) {
        NSLog(@"Error: %@ ", [error localizedDescription]);
    } else {
        NSLog(@"Done");
    }
};
[SCSoundCloud requestAccessWithPreparedAuthorizationURLHandler:^(NSURL *preparedURL){
    SCLoginViewController *loginViewController;
    loginViewController = [SCLoginViewController loginViewControllerWithPreparedURL:preparedURL completionHandler:handler];
    [self presentModalViewController:loginViewController animated:YES];
}];
 
}

I'm not sure exactly what I'm doing wrong since I followed the tutorial.

I'm also confused about the client_id, secret, and redirect URI.

Here is the code for that:

- (void) initialize {
[SCSoundCloud setClientID:@"98e77c3e4da0cc49f2f8e58f278bb813" secret:@"b8311d06a82a8c824b64b8a719479cda" redirectURL:[NSURL URLWithString:@"http://soundcloud.com/connect?client_id=98e77c3e4da0cc49f2f8e58f278bb813&redirect_uri=evesdropmusic://oauth"]];
}

Maybe I overlooked something...


Solution

  • I have found the solution to the problem!

    Apparently I think I found a bug in the newest version of XCode.

    on the "Other Linker Flags" under the Targets section -- Build Settings, I found that even though I entered the "-ObjC, -all_load", XCode decided not to save those credentials.

    The fix is to enter the flags with the (+) - click on them again, then if they go away, enter it again. It should save this time. Sometimes this doesn't occur. I'm not sure why my entries do not remain.

    Once I added these again, this fixed the issue.