Spotify API getting starred list not authorized - ios

I'm using the Spotify iOS SDK and trying to get use this function starredListForUserInSession:callback: to find a user's starred list once they have logged in.
The actual logging in of the user is working correctly, as I am able to stream Spotify tracks and a valid SPTSession is returned. I am including both the streaming and the playlist reading scopes as seen below:
SPTAuth *auth = [SPTAuth defaultInstance];
NSURL *loginPageURL = [auth loginURLForClientId:kSpotifyClientID
declaredRedirectURL:[NSURL URLWithString:kSpotifyCallbackURL]
scopes:#[SPTAuthStreamingScope, SPTAuthPlaylistReadPrivateScope]];
However, when I use the function:
[SPTRequest starredListForUserInSession:[AppDelegate sharedAccounts].spotifySession callback:^(NSError *error, id object) {
if (error) {
NSLog(#"%#", error);
}
}];
I consistently receive the following error:
"The operation couldn’t be completed. (NSURLErrorDomain error -1012.)" UserInfo=0x7a8cbf50 {NSErrorFailingURLKey=https://api.spotify.com/v1/users/(null)/starred, NSErrorFailingURLStringKey=https://api.spotify.com/v1/users/(null)/starred, NSUnderlyingError=0x7a6d5b60 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1012.)"
When I looked this up, it said that it means this request requires authentication, though the user has already been authenticated with the presumably correct scope. What am I missing?

Related

Failed to fetch full profile details from LinkedIn API

I tried to fetch full profile details from LinkedIn API. I referred a sample app also. In my app I tried,
[LISDKSessionManager createSessionWithAuth:[NSArray arrayWithObjects:LISDK_FULL_PROFILE_PERMISSION, LISDK_EMAILADDRESS_PERMISSION, nil] state:nil showGoToAppStoreDialog:YES successBlock:^(NSString *returnState) {
[self.delegate didSuccessfullyLogIntoLinkedIn];
} errorBlock:^(NSError *error) {
[self.delegate fetchingFailedWithError:error];
}];
This code gives me an error
The operation couldn’t be completed. (LISDKAuthError error 5.)
But in the sample app which is provided by the LinkedIn, This same code is working. I went through my app authentications. It has only following fields. I think the problem is, In this list there is no r_fullprofile field.
Is this the problem? Is it possible to add r_fullprofile field to this list?
Although basic access gives you only 4 fields, an answer is "Yes, it is possible". If you subscribe to LinkedIN Partnership Programs.

Spotify createPlaylistWithName results in forbidden error

I am trying to create a playlist with the Spotify iOS SDK, but am receiving the following error:
Error Domain=com.spotify.ios-sdk Code=403 "forbidden" UserInfo=0x7fb9eb577cf0 {NSLocalizedDescription=forbidden}
Here is the way that I am trying to create the playlist:
[SPTRequest playlistsForUserInSession:session callback:^(NSError *error, SPTPlaylistList *myPublicPlaylists) {
[myPublicPlaylists createPlaylistWithName:playlistName publicFlag:FALSE session:session callback:^(NSError *error, SPTPlaylistSnapshot *myRequestedPlaylist) {
if (error != nil) {
return;
}
success(myRequestedPlaylist);
}];
}];
I have verified that the session is valid and the SPTPlaylistlist returned from playlistsForUserInSession is correct. What is the correct method for creating a playlist to avoid this error?
As per the Readme from the iOS SDK release, "When connecting a user to your app, you must provide the scopes your application needs to operate. A scope is a permission to access a certain part of a user's account, and if you don't ask for the scopes you need you will receive permission denied errors when trying to perform various tasks."
In this case, it is necessary to give permissions for either (or both) SPTAuthPlaylistModifyPrivateScope and SPTAuthPlaylistModifyPublicScope.
For example:
// Create SPTAuth instance; create login URL and open it
SPTAuth *auth = [SPTAuth defaultInstance];
NSURL *loginURL = [auth loginURLForClientId:kClientId
declaredRedirectURL:[NSURL URLWithString:kCallbackURL]
scopes:#[SPTAuthStreamingScope, SPTAuthPlaylistModifyPrivateScope, SPTAuthPlaylistModifyPublicScope]];

Photobucket iOS API Authentication

I'm trying to integrate Photobucket iOS API with my project. I requested and already have consumer key and secret. But I have a problem with authentication (may be there is will be problems with upload). Please look at my code.
At first init photobucket manager:
manager = [[PhotobucketAPI alloc] initWithConsumerKey:photobucketConsumerKey
consumerSecret:photobucketConsumerSecret
globalErrorDelegate:self];
Then request authentication:
[manager loginDirectAndStoreForUsername:login
password:pass
delegate:self
didSucceedSelector:#selector(didSucceedLogin:)
didFailSelector:#selector(didFailLogin:)
downloadProgressDelegate:self
uploadProgressDelegate:self];
This is how look like method didFailLogin::
- (void)didFailLogin:(NSError *)error
{
if (error)
NSLog(#"Error: %#", error);
}
And all time I'm getting this error:
Error Domain=Authentication failed. Code=999 "The operation couldn’t
be completed. (Authentication failed. error 999.)"
So what I doing wrong?

Taking turn in Turn Based Game on Google Play Games for iOS gives "The operation couldn’t be completed. (com.google.GooglePlayGames error 3.)"

I'm at the point now where a player invited to a Turn-Based Match has the match.myStatus of GPGTurnBasedParticipantStatusJoined, match.userMatchStatus of GPGTurnBasedUserMatchStatusTurn, and match.isMyTurn of YES. Yet when they call this method:
[self.match
takeTurnWithNextParticipantId:nextParticipantID
data:[NSJSONSerialization dataWithJSONObject:#{#"A test": #"My test"} options:0 error:nil]
results:nil
completionHandler:^(NSError *error) {
NSLog(#"took turn with error: %#, data: %i", error, self.match.data.length);
if (error) {
return;
}
//Continue
}];
They get this error:
Error Domain=com.google.GooglePlayGames Code=3 "The operation couldn’t
be completed. (com.google.GooglePlayGames error 3.)"
This error is entirely undocumented on Google's part. I have no indication of what the issue is, or what I could be doing wrong, considering everything points to the code above being correct.
Make sure that you pass the participant id, not the player id! See also the answer of your other post: Google Play Games not allowing user to join turn-based match

Error! When sharing a post to Facebook in background

I am using a API call to share a post to facebook.
I am getting a error when i click a share button.
Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x9289500 {com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 2500;
message = "An active access token must be used to query information about the current user.";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:HTTPStatusCode=400}
How can i solve this issue.
Any help is appreciated.
code 2500 means that FBSDK failed to retrive user information; check whether your FBAppId is correct with all settings
You have to integrate the latest Facebook SDK into your project from the following link:
https://developers.facebook.com/docs/ios

Resources