Error! When sharing a post to Facebook in background - ios

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

Related

Disabled Facebook Login iOS throws com.facebook.sdk.core Code=8

Our App was disabled a week ago due to violation on 6.1 and we tried to fix the issue
I have tried reimplementing the login following the instructions on the Facebook login setup guide. Also tried updating from 9.0.1 to the latest version 12.1.0
I can confirm that the info.plist is correct, the permissions are correct, bundle id is correct, and we only use test accounts.
However this error still throws, I could not find any references to fix this.
Could anyone help?
Don't know if this helps but the android app using version 5.4.0 build is working fine
Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={NSRecoveryAttempter=<_FBSDKTemporaryErrorRecoveryAttempter: 0x1630097f0>, NSLocalizedRecoverySuggestion=The server is temporarily busy, please try again., com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Unsupported request, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=400, com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCodeKey=1, NSLocalizedRecoveryOptions=(
OK
), com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 1;
"fbtrace_id" = ANc5PSXRGPTACuYqqxYTDda;
message = "Unsupported request";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:FBSDKGraphRequestErrorKey=1}
From your error response, it seems like you are requesting data from a not-existing API or that your token is invalid
error = {
code = 1;
"fbtrace_id" = ANc5PSXRGPTACuYqqxYTDda;
message = "Unsupported request";
type = OAuthException;
};
from Facebook's docs: OAuthException | code= 1
//API Unknown//
Possibly a temporary issue due to downtime. Wait and retry the operation. If it occurs again, check that you are requesting an existing API.

Google Places API Autocomplete not working bad request

I'm trying to use Google places API to get autocomplete.
I've checked everything:
API keys are activated (disabled every restriction)
I'm calling GMSServices.provideAPIKey and GMSPlacesClient.provideAPIKey
Initializing the object placesClient = GMSPlacesClient.shared()
The call I'm making is:
let filter = GMSAutocompleteFilter()
filter.type = .establishment
placesClient?.autocompleteQuery(textField.text!, bounds: nil, filter: filter) { (predictionList, error) in
if let error = error {
print("Pick Place error: \(error.localizedDescription)")
return
}
if let list = predictionList{
self.resultList = list
}
}
The error I'm getting is:
Printing description of error: Error
Domain=com.google.places.ErrorDomain Code=-3 "An internal error
occurred in the Places API library. If you believe this error
represents a bug, please file a report using the instructions on our
community and support page
(https://developers.google.com/places/support)."
UserInfo={NSLocalizedFailureReason=An internal error occurred in the
Places API library. If you believe this error represents a bug, please
file a report using the instructions on our community and support page
(https://developers.google.com/places/support).,
NSUnderlyingError=0x608000445370 {Error
Domain=com.google.places.server.ErrorDomain Code=-1 "(null)"
UserInfo={NSUnderlyingError=0x60800024f030 {Error
Domain=com.google.GTLRErrorObjectDomain Code=400 "(Bad Request)"
UserInfo={error=Bad Request, GTLRStructuredError=GMSx_GTLRErrorObject
0x60800024f9f0: {message:"Bad Request" errors:[1] code:400},
NSLocalizedFailureReason=(Bad Request)}}}}}
Has anyone else seen this problem in Xcode 8 iOS 10? Thanks
EDIT: Now it seems that some requests are working... Maybe the server is having problems?

Adding Firebase SDK somehow breaks facebook login for no apparent reason

I'm running Xcode beta 10, with ios 10 beta, and I got my facebook login working.
if I simply just add
import Firebase and FIRApp.configure() in my appdelegate, I get the following error:
Optional(Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=0, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=400, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=An active access token must be used to query information about the current user., com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=2500, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 2500;
"fbtrace_id" = CIheVvb2bpQ;
message = "An active access token must be used to query information about the current user.";
type = OAuthException;
};
};
code = 400;
}})
This makes virtually no sense to me, I'm not doing anything with firebase yet, not trying to authenticate or track a login, why would simply importing firebase, and configuring it in the appdelegate cause this, and any ideas on how to fix?

How to get token_for_business for Facebook login - iOS

How can I get token_for_business from Facebook login? I have setup a business and associated my application with that business. Facebook documentation says you need to call GET /me?fields=token_for_business on User node, and it will return following json.
{
"id": "1234567890"
"token_for_business": "weg23ro87gfewblwjef"
}
I tried by providing token_for_business in parameter list of /me call but didn't work. Need advises.
Edit
I found this URL https://developers.facebook.com/docs/graph-api/reference/v2.5/user and tried by passing token_for_business in param of initWithGraphPath but no gain. I checked in Graph API Explorer and getting the required data. But not sure how to call from my objective-C code.
Edit 2
I Inspected the error object of initWithGraphPath:#"me?fields=token_for_business" call and found following details
Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=0, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=403, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=(#200) Application must be associated with a business. https://business.facebook.com/, com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=200, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 200;
"fbtrace_id" = "EN9bN/YMloA";
message = "(#200) Application must be associated with a business. https://business.facebook.com/";
type = OAuthException;
};
};
code = 403;
}}
But if I try my app in Graph API Explorer then I'm getting the required data. So now it confusing me.

Spotify API getting starred list not authorized

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?

Resources