Update: Xcode 9.3 has fixed it.
When creating UIDocument File in UIDocumentBrowserViewController
[default] [ERROR] Could not resolve bookmark. Error: Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not permitted to access the URL." UserInfo={NSLocalizedDescription=The reader is not permitted to access the URL.}
[DocumentManager] Failed to create a url from bookmarkableString (Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not permitted to access the URL." UserInfo={NSLocalizedDescription=The reader is not permitted to access the URL.})
Code work well in Xcode 9.1, But Failed in Xcode 9.2. almost the same code as wwdc 2017.
func documentBrowser(_ controller: UIDocumentBrowserViewController, didRequestDocumentCreationWithHandler importHandler: #escaping (URL?, UIDocumentBrowserViewController.ImportMode) -> Void) {
let newDocumentURL: URL? = R.file.templateDocument()
// Set the URL for the new document here. Optionally, you can present a template chooser before calling the importHandler.
// Make sure the importHandler is always called, even if the user cancels the creation request.
if newDocumentURL != nil {
importHandler(newDocumentURL, .copy)
} else {
importHandler(nil, .none)
}
}
Related
I'm trying to make NFC work on a iOS phone and now I'm getting this error:
[CoreNFC] 00000002 82426be0 -[NFCHardwareManager areFeaturesSupported:outError:]:154 XPC Error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.nfcd.service.corenfc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service named com.apple.nfcd.service.corenfc was invalidated from this process.}
The package I'm currently using is nfc_manager
Here is the code that's being used:
openNFC() async {
// Check availability
bool isAvailable = await NfcManager.instance.isAvailable();
// Start Session
if (isAvailable == true) {
NfcManager.instance.startSession(
onDiscovered: (NfcTag tag) async {
print(tag);
},
);
} else {
print("Your device is not compatible with NFC");
}
// Stop Session
NfcManager.instance.stopSession();
}
Can someone please help me? Thanks in advance❤️
When I run the app with .storekit configuration file in Xcode 12.2 / iOS 14.2 Simulator, my SKReceiptRefreshRequest always fails, I get an error in my func request(_ request: SKRequest, didFailWithError error: Error) delegate method. Here are the logs:
# Printed by some Apple internal framework:
<SKReceiptRefreshRequest: 0x60000320d640>: Finished refreshing receipt with error: Error Domain=ASDServerErrorDomain Code=5002 "Unhandled exception" UserInfo={NSLocalizedDescription=Unhandled exception, NSLocalizedFailureReason=An unknown error occurred}
# Error logged by my code:
Failed to refresh app receipt: Error Domain=SKErrorDomain Code=0 "UNKNOWN_ERROR" UserInfo={NSLocalizedDescription=UNKNOWN_ERROR, NSUnderlyingError=0x600003c9a040 {Error Domain=ASDServerErrorDomain Code=5002 "Unhandled exception" UserInfo={NSLocalizedDescription=Unhandled exception, NSLocalizedFailureReason=An unknown error occurred}}}
I run the request as usual:
class ReceiptFetcher: NSObject {
func fetchReceipt() {
let request = SKReceiptRefreshRequest(receiptProperties: nil)
request.delegate = self
request.start()
}
}
extension ReceiptFetcher: SKRequestDelegate {
func requestDidFinish(_ request: SKRequest) {
LogVerbose("App receipt refreshed!")
// Handling success
}
func request(_ request: SKRequest, didFailWithError error: Error) {
LogVerbose("Failed to refresh app receipt: \(error)")
// Handling error
}
}
Everything worked fine until I upgraded Xcode to 12.2. Now it fails for both Run and Test actions.
I found nothing about ASDServerErrorDomain with code 5002. Any help on that?
Everything works again since Xcode 12.4. I hope they won't break this thing again...
My anonymous login for Firebase was working for months; however, when Xcode forced me to install some updates, it couldn't find some pods. After deleting those pods after running pod update, the project will now build; however, while attempting the anonymous login, I get this error:
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
If I wait long enough, I get error messages like this:
[Client] Discarding message for event <private> because of too many unprocessed messages
Here is my login method:
func login(onCompletion: #escaping (NSError?) -> Void) {
print("authenticating user")
FIRAuth.auth()?.signInAnonymously(completion: { result, error in
guard error == nil else {
print("error while authenticating user")
onCompletion(loginError)
return
}
if let user = result {
self.defaults.set(user.uid, forKey: "uid")
onCompletion(nil)
} else {
onCompletion(loginError)
}
})
}
which is called in the root view controller's viewDidLoad.
I still don't know what the issue was, but it was specific to the project. I created a new project and pulled the code from github and now it works like normal.
I'm trying to implement authentication between my Swift app and Pinterest. I can get the app to open pinterest authentication page in Safari but the after I enter my Pinterest username/password and press OKAY, the app throws the following error message:
CODE:
PDKClient.configureSharedInstanceWithAppId("************")//replaced appid with ****
let permission = [PDKClientReadPublicPermissions]
PDKClient.sharedInstance().authenticateWithPermissions(permission, fromViewController: self, withSuccess: { (pdk :PDKResponseObject!) -> Void in print("success PDKResponseObject: \(pdk)")
}) { (err :NSError!) -> Void in
print("errori tuli: error NSError: \(err)")
}
ERROR:
-canOpenURL: failed for URL: "pinterestsdk.v1://oauth/?app_name=MyApp&permissions=read_public&client_id=4853625080298613350" - error: "(null)"
I can't figure out what's wrong. ALL HELP APPRECIATED!
The answer lies here at Gibhub. In short, I was editing the wring plist.info. https://github.com/pinterest/ios-pdk/issues/117#issuecomment-244440823
For some weeks now my app is unable to reset the CloudKit badge. I am getting a 'Network Failure' error. It did work before and I have not changed any code. I cannot find anything about changed functionality. Is this a CloudKit bug? Should i file a Radar? Or am I doing something wrong?
Here is the code that I use:
public func setBadgeCounter(count:Int) {
let badgeResetOperation = CKModifyBadgeOperation(badgeValue: count)
badgeResetOperation.modifyBadgeCompletionBlock = { (error) -> Void in
func handleError(error: NSError) -> Void {
EVLog("Error: could not reset badge: \n\(error)")
}
self.handleCallback(error, errorHandler: handleError, completionHandler: {
UIApplication.sharedApplication().applicationIconBadgeNumber = count
})
}
CKContainer.defaultContainer().addOperation(badgeResetOperation)
}
internal func handleCallback(error: NSError?, errorHandler: ((error: NSError) -> Void)? = nil, completionHandler: () -> Void) {
if (error != nil) {
EVLog("Error: \(error?.code) = \(error?.description) \n\(error?.userInfo)")
if let handler = errorHandler {
handler(error: error!)
}
} else {
completionHandler()
}
}
The error that I get with this is:
04/15/2015 09:12:28:837 AppMessage)[10181:.] EVCloudKitDao.swift(202) handleCallback(_:errorHandler:completionHandler:):
Error: Optional(4) = Optional("<CKError 0x7fb451c77c10: \"Network Failure\" (4/-1003); \"A server with the specified hostname could not be found.\">")
Optional([NSErrorFailingURLStringKey: https://ckdevice.icloud.com/api/client/badgeUpdate, _kCFStreamErrorCodeKey: 8, NSDebugDescription: NSURLErrorDomain: -1003, NSLocalizedDescription: A server with the specified hostname could not be found., NSErrorFailingURLKey: https://ckdevice.icloud.com/api/client/badgeUpdate, NSUnderlyingError: Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo=0x7fb45351a890 {NSErrorFailingURLStringKey=https://ckdevice.icloud.com/api/client/badgeUpdate, NSErrorFailingURLKey=https://ckdevice.icloud.com/api/client/badgeUpdate, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSLocalizedDescription=A server with the specified hostname could not be found.}, _kCFStreamErrorDomainKey: 12])
04/15/2015 09:12:28:839 AppMessage)[10181:.] EVCloudKitDao.swift(788) handleError:
Error: could not reset badge:
<CKError 0x7fb451c77c10: "Network Failure" (4/-1003); "A server with the specified hostname could not be found.">
A complete functional app with this problem can be found at https://github.com/evermeer/EVCloudKitDao
It's an Apple Bug. I use your Apple based API, timeout a user when attempting to log in from a foreign country. Using VPN from US solves the problem, suggesting Cloudkit isn't friendly to non-US territories. Using the API no problem before, it seems this is their latest change.
Specifically,
CKContainer.fetchUserRecordIDWithCompletionHandler, takes too long or never return.
Reference from Apple Doc
At startup time, fetching the user record ID may take longer while
CloudKit makes the initial iCloud account request. After the initial
fetch, accessing the user record ID should take less time. If no
iCloud account is associated with the device, or if access to the
user’s iCloud account is restricted, this method returns an error of
type CKErrorNotAuthenticated.
#Edwin Vermeer
Please correct me if you have solved it with the updated of your API or Apple fixes it.