Show share dialog for Facebook Graph Api - iOS - ios

I'm trying to share an object which I've create at the objects tab at the open graph section.
FBSDKGameRequestContent *gameRequestContent = [[FBSDKGameRequestContent alloc] init];
gameRequestContent.message = message;
gameRequestContent.title = title;
gameRequestContent.recipients = #[#"400098323516165"];
gameRequestContent.actionType = actionType;
gameRequestContent.objectID = #"123456"; //I also tried by the name : bingoclimb:life
FBSDKGameRequestDialog* dialog = [[FBSDKGameRequestDialog alloc] init];
dialog.frictionlessRequestsEnabled = YES;
dialog.content = gameRequestContent;
dialog.delegate = self;
[dialog show];
My objects section looks like this:
If I try with this code (with the id) I get the following error:
Error Domain=com.facebook.sdk.share Code=2 "The operation couldn’t be
completed. (com.facebook.sdk.share error 2.)" UserInfo=0x170c6cdc0
{com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Sorry, this feature
isn't available right now: An error occurred while processing this
request. Please try again later.}
If I try with the objectId as name I get the following error:
Error Domain=com.facebook.sdk.share Code=100 "The operation couldn’t
be completed. (com.facebook.sdk.share error 100.)"
UserInfo=0x17066eb40
{com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Invalid fbid.}
Note: the user has publish_actions permission.
Also, when I copy the creation code from the "Sample code for object" and run it I get the following error:
Error Domain=com.facebook.sdk.share Code=201 "The operation couldn’t
be completed. (com.facebook.sdk.share error 201.)"
UserInfo=0x17046a240
{com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Error creating Open
Graph object: Error Domain=com.facebook.sdk.core Code=8 "The operation
couldn’t be completed. (com.facebook.sdk.core error 8.)"
UserInfo=0x1701accc0
{NSRecoveryAttempter=<_FBSDKTemporaryErrorRecoveryAttempter:
0x170016150>, com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=1,
NSLocalizedRecoverySuggestion=The server is temporarily busy, please
try again., com.facebook.sdk:FBSDKErrorDeveloperMessageKey=An unknown
error has occurred.,
com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=500,
com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=1,
NSLocalizedRecoveryOptions=(
OK ), com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 1;
"fbtrace_id" = "BGhIEBfOI+b";
message = "An unknown error has occurred.";
type = OAuthException;
};
};
code = 500; }}, NSUnderlyingError=0x17005abb0 "The operation couldn’t be completed. (com.facebook.sdk.core error 8.)"}

Related

Facebook OAuthException with 500 (error code 8)

I'm working with the Facebook iOS SDK (version 15).
When logging in and returning to the app, the Facebook SDK keeps throwing this error
▿ Optional<Error>
- some : Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={NSRecoveryAttempter=<FBSDKTemporaryErrorRecoveryAttempter: 0x28219d100>, com.facebook.sdk:FBSDKGraphRequestErrorKey=1, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=An unknown error has occurred., com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 1;
"fbtrace_id" = AK1LoNJP0ca0quThgMVlELr;
message = "An unknown error has occurred.";
type = OAuthException;
};
};
code = 500;
}, NSLocalizedRecoveryOptions=(
OK
), com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=500, NSLocalizedRecoverySuggestion=The server is temporarily busy, please try again., com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCodeKey=1}
Because of this, Facebook keeps blocking my app, so users cannot log in using Facebook.
Any ideas on what the cause of this could be?

"comgooglemaps://" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

I'm using the Google API with xamarin ios. I'm trying to use the
Schema of URLs of Google Maps to do a search of a site .. this is my code..
if (UIApplication.SharedApplication.CanOpenUrl(new NSUrl("comgooglemaps://")))
{
var pizza = "comgooglemaps://" + "?q=Pizza&center=37.759748,-122.427135";
var busqPizza = new NSUrl(pizza);
UIApplication.SharedApplication.OpenUrl(busqPizza);
}
else {
Console.WriteLine("No puede usar comgooglemaos://");
}
error..
-canOpenURL: failed for URL: "comgooglemaps://" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
I have found a solution but I do not know if it is the correct form but I work. This is the solution instead of using comgooglemaps:// use http://maps.apple.com?xxxxxx
var pizza = "http://maps.apple.com?q=Pizza&center=20.661922,-103.392030";
UIApplication.SharedApplication.OpenUrl(NSUrl.FromString(pizza));

I'm unable to get Deep linking to respond in the swift iOS simulator

So I'm trying to get FB and Twitter to respond from tappin on a table cell:
I set up the plist:
Then I created this function:
func schemeAvailable(scheme: String) -> Bool {
if let url = URL(string: scheme) {
return UIApplication.shared.canOpenURL(url)
}
return false
}
Then I tried to use it:
print(UIApplication.shared.canOpenURL(URL(string: "fb:")!))
if(schemeAvailable(scheme: "fb://")){
print("facebook agailable")
}
if(schemeAvailable(scheme: "twitter://")){
print("twitter agailable")
}
and get back a response of:
2016-10-03 17:04:09.096 JSONTesting[73245:2492124] -canOpenURL: failed for URL: "fb:" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
false
2016-10-03 17:04:09.097 JSONTesting[73245:2492124] -canOpenURL: failed for URL: "fb://" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2016-10-03 17:04:09.098 JSONTesting[73245:2492124] -canOpenURL: failed for URL: "twitter://" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
I've tried with and without the // in the string but to no avail...get the same error back every time.
Thanks

Amazon s3 Image Upload (cognito id null)

Image is not uploading in a amazon s3 . I was using the old library all the upload was working fine but for ios 8 i use new sdk and create new conginito id
now i am facing errors. any help will be appreciated
My code is
AWSS3TransferManagerUploadRequest *request = [[AWSS3TransferManagerUploadRequest alloc] init];
request.bucket = #"my bucket name";
request.key = #"my cognitio id";
request.body =[NSURL fileURLWithPath:path];
request.contentType = #"image/png";
[[transferManager upload:request] continueWithExecutor:[BFExecutor mainThreadExecutor]
withBlock:^id(BFTask *task) {
NSLog(#"ckmdkcd dvdsv");
if (task.error) {
if ([task.error.domain isEqualToString:AWSS3TransferManagerErrorDomain]) {
switch (task.error.code) {
case AWSS3TransferManagerErrorCancelled:
case AWSS3TransferManagerErrorPaused:
break;
default:
NSLog(#"Error: %#", task.error);
break;
}
} else {
// Unknown error.
NSLog(#"Error: %#", task.error);
}
}
if (task.result) {
AWSS3TransferManagerUploadOutput *uploadOutput = task.result;
// The file uploaded successfully.
NSLog(#"result = %#",task.result);
}
return nil;
}];
I got the following response
AWSiOSSDKv2 [Error] AWSIdentityProvider.m line:185 | __51-[AWSAbstractCognitoIdentityProvider getIdentityId]_block_invoke169 | GetId failed. Error is [Error Domain=NSURLErrorDomain Code=-1003 "The operation couldn’t be completed. (NSURLErrorDomain error -1003.)" UserInfo=0x7f9b987aabf0 {NSErrorFailingURLStringKey=https://cognito-identity.(null).amazonaws.com/, NSErrorFailingURLKey=https://cognito-identity.(null).amazonaws.com/, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSUnderlyingError=0x7f9b9a839480 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1003.)"}]
2015-04-14 08:13:16.326 newtest[6611:172200] AWSiOSSDKv2 [Error] AWSCredentialsProvider.m line:534 | __40-[AWSCognitoCredentialsProvider refresh]_block_invoke350 | Unable to refresh. Error is [Error Domain=NSURLErrorDomain Code=-1003 "The operation couldn’t be completed. (NSURLErrorDomain error -1003.)" UserInfo=0x7f9b987aabf0 {NSErrorFailingURLStringKey=https://cognito-identity.(null).amazonaws.com/, NSErrorFailingURLKey=https://cognito-identity.(null).amazonaws.com/, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSUnderlyingError=0x7f9b9a839480 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1003.)"}]
2015-04-14 08:13:16.328 newtest[6611:172071] ckmdkcd dvdsv
2015-04-14 08:13:16.328 newtest[6611:172071] Error: Error Domain=NSURLErrorDomain Code=-1003 "The operation couldn’t be completed. (NSURLErrorDomain error -1003.)" UserInfo=0x7f9b987aabf0 {NSErrorFailingURLStringKey=https://cognito-identity.(null).amazonaws.com/, NSErrorFailingURLKey=https://cognito-identity.(null).amazonaws.com/, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSUnderlyingError=0x7f9b9a839480 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1003.)"}
I am also setting cognitio id in app delegate.
Based on the fact that you seeing https://cognito-identity.(null).amazonaws.com/ in the error, it would lead me to believe you are not correctly setting the region when creating the AWSCognitoCredentialsProvider. Please double check that you are not setting this to AWSRegionUnknown.
Update 2015-04-17: Here is the list of Region constants. You should set this to the region where your identity pool exists. Currently Amazon Cognito is only available in AWSRegionUSEast1 or AWSRegionEUWest1.
Note, the region of your identity pool has nothing to do the region of other AWS services you may use in your application. You can use an identity pool in AWSRegionUSEast1 to access resources in AWSRegionSAEast1, for instance.

NSURL Error code extraction

I try to do my NSURL error-handling and have a little problem.
When i'm getting an error i want to handle it different for different error-codes.
In my case i want to check if the error that i'm getting is the one with errorcode 1005.
This is what I get when I print as follows:
NSLog(#"%#",error);
Error Domain=NSURLErrorDomain Code=-1005 "The operation couldn’t be completed. (NSURLErrorDomain error -1005.)" UserInfo=0x1700ff000 {NSErrorFailingURLStringKey=MyURL, NSErrorFailingURLKey=MyURL, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-4, NSURLSessionDownloadTaskResumeData=<CFData 0x17025a580 [0x1936b2c80]>{length = 3640, capacity = 4096, bytes = 0x3c3f786d6c2076657273696f6e3d2231 ... 2f706c6973743e0a}, NSUnderlyingError=0x17025cf80 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1005.)"}
and this is what I want to extract from it:
-1005
I already searched for it and found a solution which doesn't work. (I get EXC_BAD_ACCESS)
NSLog(#"%#", [error code]);
Afterwards I want to compare it similar to:
if(error.code == -1005){
//handle error
}
You can't use:
NSLog(#"%#", [error code]);
Because code is NSInteger. Use:
NSLog(#"%d", [error code]);
Refer: NSError Class Reference for more details

Resources