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

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

Related

CoreData: error: (778) I/O error for database ? How to handle this error?

I'm getting a Core data error when my app is in open state with lock screen mode.
My code:
func savePesistenceContext() {
//try! self.dataStack.mainContext.save()
do {
try self.dataStack.mainContext.save()
} catch {
let nserror = error as NSError
debugPrint("savePesistenceContext", nserror)
}
}
Error:
CoreData: error: SQLCore dispatchRequest: exception handling request: <NSSQLSaveChangesRequestContext: 0x280697540> , I/O error for database at /var/mobile/Containers/Data/Application/6EBC7CD6-9299-431A-A24A-1F6FA86792BD/Documents/Coral.sqlite. SQLite error code:778, 'disk I/O error' with userInfo of {
NSFilePath = "/var/mobile/Containers/Data/Application/6EBC7CD6-9299-431A-A24A-1F6FA86792BD/Documents/Coral.sqlite";
NSSQLiteErrorDomain = 778;
}
CoreData: error: (778) I/O error for database at /var/mobile/Containers/Data/Application/6EBC7CD6-9299-431A-A24A-1F6FA86792BD/Documents/Coral.sqlite. SQLite error code:778, 'disk I/O error'
Error Domain=NSCocoaErrorDomain Code=256 "The file “Coral.sqlite” couldn’t be opened." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/9AB16F39-8933-4A75-AB6A-59CBBCC42A4F/Documents/Coral.sqlite, NSSQLiteErrorDomain=23}
When will this error come and how can we resolve this error?

The operation couldn’t be completed. (NSURLErrorDomain error -1011.)

I'm trying to upload an image to a FTP server using swift 4
I used FileProvider which is a library for Ftp connection iOS
anyway I'm checking the provider is reachable. and Im getting this error
The operation couldn’t be completed. (NSURLErrorDomain error -1011.)
this is the full error object:
Error Domain=NSURLErrorDomain Code=-1011 "(null)" UserInfo={NSErrorFailingURLKey=ftp://xxxx.xxxx.xxxx.xxxx:21/, NSErrorFailingURLStringKey=ftp://xxxx.xxxx.xxxx.xxxx:21/, NSURL=ftp://xxxx.xxxx.xxxx.xxxx:21/}
this is my code:
self.ftpProvider!.isReachable { (flag, error) in
if flag {
print("RIZK:--- provider is reachable ")
let progress = self.ftpProvider!.copyItem(localFile: localURL, to: "/files/\(imageName)", overwrite: true, completionHandler: { (error) in
if error == nil {
print("RIZK:-- Ready to upload")
}else{
print("RIZK:--\(error?.localizedDescription ?? "")")
}
})
print(progress?.fractionCompleted ?? 0)
}else{
print("RIZK:--- provider not reachable, with error \(error?.localizedDescription ?? "") ")
}
}

"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));

Show share dialog for Facebook Graph Api - 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.)"}

plist attachment from email in swift (NS Cocoa Error Domain Code 260)

I am sending some ios file data via an email contained in a plist. No issues attaching it, I can check the file and the contents. It's all there and I can open it as a plist. Clicking on it (I have associated it with my app) it opens and I get a valid path:
file:///private/var/mobile/Containers/Data/Application/C5454580-2BEB-4515-9BDE-FED85FF54F76/Documents/Inbox/ShareStrength-11.bps
that I pass but when I try and read back the NSDictionary (plist) I get nil content.
let sourceFile = NSDictionary(contentsOfFile: URLString)
Any ideas on what is going wrong. Having difficulty debugging.
EDIT: I found some error code:
var error: NSError?
let content = NSString(contentsOfFile: URLString, encoding:NSUTF8StringEncoding, error: &error)
if content != nil
{
println("content: \(content)")
}
else
{
println("error: \(error)")
}
And I get the error:
error: Optional(Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn’t be completed. (Cocoa error 260.)" UserInfo=0x17eceeb0 {NSFilePath=file:///private/var/mobile/Containers/Data/Application/571DB0FF-6C5A-4BEB-9FA8-6E4DFE10E850/Documents/Inbox/ShareStrength-13.bps, NSUnderlyingError=0x17ee9810 "The operation couldn’t be completed. No such file or directory"})
Is this a sandbox issue? How can I copy the attachment being passed as a URL?
I was using:
let URLString: String = url.absoluteString!
instead of:
let URLString: String = url.path!
Hope this helps someone else

Resources