Posts

Post not yet marked as solved
2 Replies
Not really. I managed to obtain the url of the file with the following trick. I can try to find something similar to write the file back, but I'm afraid it might be unstable or unpredictable. import ObjectiveC // Declare a global var to produce a unique address as the assoc object handle private var AssociatedObjectHandle: UInt8 = 0 extension FileWrapper {     var fileURL: URL? {         get {             return objc_getAssociatedObject(self, &AssociatedObjectHandle) as? URL         }         set {             objc_setAssociatedObject(self, &AssociatedObjectHandle, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)         }     }     @objc convenience init(trick url: URL, options: ReadingOptions) throws {         try self.init(trick: url, options: options)         self.fileURL = url     } } struct Trick {     static func execute() {         let aClass: AnyClass = FileWrapper.self         let originalMethod = class_getInstanceMethod(aClass, #selector(FileWrapper.init(url:options:)))         let swizzledMethod = class_getInstanceMethod(aClass, #selector(FileWrapper.init(trick:options:)))         guard let originalMethod = originalMethod, let swizzledMethod = swizzledMethod else {             return         }         method_exchangeImplementations(originalMethod, swizzledMethod)     } }
Post not yet marked as solved
3 Replies
I’m reporting this cause I think that, like the Google SDK and the Facebook SDK, apple should allow the client library to refresh the issued token directly from the client itself.The ASAuthorizationControllerDelegate has the methodfunc authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization)The authorization.credential is of type ASAuthorizationAppleIDCredential and contains an identityToken.The token is a JWT with a 600 seconds validity, but there is no method to get a new identityToken from the client after the login is completed (of course if the user has not revoked the authorisation)