Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8170505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:08:50+00:00 2026-06-06T21:08:50+00:00

I have a problem with SoundCloud API in my application. I have created an

  • 0

I have a problem with SoundCloud API in my application.
I have created an app, what get link to the track (e.g. something like this http://api.soundcloud.com/tracks/48760960) and get stream_url, what later can be played using SCAudioStream. There is no auth for users, I use only client id and client secret of my app. App is registered.

I create soundCloudManager this way:

- (id)init
{
    if(self = [super init])
    {
        conf = [SCSoundCloudAPIConfiguration configurationForProductionWithClientID: kSCClientID
                                                                       clientSecret: kSCClientSecret
                                                                        redirectURL: kSCRedirectURL];
        conf.accessTokenURL = kSCAccessTokenURL;
        api = [[SCSoundCloudAPI alloc] initWithDelegate: self 
                                 authenticationDelegate: self 
                                       apiConfiguration: conf];
       //[api checkAuthentication];
    }
    return self;
}

If uncomment [api checkAuthentication], then logs will says next:

“auth ready with URL:https://soundcloud.com/connect?client_id=&redirect_uri=&response_type=code”

Then I call this method to get data from track:

- (void)runSearchingStreamWithTrackID: (NSString *)trackID
{
    [api performMethod: @"GET" 
            onResource: @"tracks" 
        withParameters: [NSDictionary dictionaryWithObject:trackID forKey:@"ids"] 
               context: @"trackid" 
              userInfo: nil];
}

And then this delegate’s method calls:

- (void)soundCloudAPI:(SCSoundCloudAPI *)soundCloudAPI 
     didFailWithError:(NSError *)error 
              context:(id)context 
             userInfo:(id)userInfo 

Text of error:

“HTTP Error: 401”.

It means unauthorized. But why? Should I be authorized as soundCloud user to getting info about tracks?

I’m using this for SoundCloudAPI:
https://github.com/soundcloud/cocoa-api-wrapper

Please, help! 🙁


Today I fixed it. I just add this method to init :

[api authenticateWithUsername:kLogin password:kPwd];

After it this method was called:

- (void)soundCloudAPIDidAuthenticate

So, this test account was authorized.

Then I call this method:

- (void)runSearchingStreamWithTrackID: (NSString *)trackID
{
    [api performMethod: @"GET" 
            onResource: @"tracks" 
        withParameters: [NSDictionary dictionaryWithObject:trackID forKey:@"ids"] 
               context: @"trackid" 
              userInfo: nil];
}

And no one of these methods will be called:

- (void)soundCloudAPI:(SCSoundCloudAPI *)soundCloudAPI 
     didFailWithError:(NSError *)error 
              context:(id)context 
             userInfo:(id)userInfo;
- (void)soundCloudAPI:(SCSoundCloudAPI *)soundCloudAPI 
    didFinishWithData:(NSData *)data 
              context:(id)context 
             userInfo:(id)userInfo;
- (void)soundCloudAPIDidAuthenticate;
- (void)soundCloudAPIDidResetAuthentication;
- (void)soundCloudAPIDidFailToGetAccessTokenWithError:(NSError *)error;
- (void)soundCloudAPIPreparedAuthorizationURL:(NSURL *)authorizationURL;

But there is log:

-[NXOAuth2PostBodyStream open] Stream has been reopened after close

And this method was called:

[NXOAuth2Client oauthConnection:connection didFailWithError:error];
error: HTTP 401

What do I wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T21:08:52+00:00Added an answer on June 6, 2026 at 9:08 pm

    I understood the problem. Just download the SC API from the official site and install the latest SC API. Then do something like this:

    - (void)searchStreamURLByTrackID: (NSString *)trackID
    {
    NSString *string = [NSString stringWithFormat:@"https://api.soundcloud.com/tracks/%@.json?client_id=%@", trackID, kSCClientID];
    
    [SCRequest performMethod: SCRequestMethodGET 
                  onResource: [NSURL URLWithString:string]
             usingParameters: nil 
                 withAccount: nil
      sendingProgressHandler: nil 
             responseHandler:^(NSURLResponse *response, NSData *data, NSError *error){
    
                                          NSString *resultString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                                          NSLog(@"FOUND:\n%@", resultString);
                                  }
                          ];
    

    }

    After that obtain the stream url from the JSON in the resultString.

    Finally, you have to write this code:

    NSString *streamURL = [(NSDictionary *)jsonData objectForKey:@"stream_url"];
    NSString *realURL = [streamURL stringByAppendingFormat:@".json?client_id=%@", kSCClientID];
    AVPlayer *player = [[AVPlayer alloc] initWithURL:[NSURL URLWithString:realURL]];
    

    Enjoy!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with php's preg_match.I want to make something like this : When
I have problem like this https://dev.twitter.com/discussions/4563 if (webResponse.Headers[Content-Encoding] == gzip) { byte[] bytes =
I have problem with http://abfoodpolicy.com/ . In IE 8 and 9 the right sidebar
I have problem with setting OpenGL 3.3 application with glfw. I get OpenGL profile
I have problem with sql query. For example, I have table like this: ID
I have problem with my query on C, I’m using the oci8 driver. This
I have problem with show or hide form in Window Form Application. I start
I have problem in creating modular analysis architecture for C# application. Aim: It is
i have problem with jquery submit and post. I would like to submit a
I have problem with filling a Map in Java, I think this is simple,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.