Mark L.45 Collaborator | Level 9

Comments

  • I figured out what I was doing wrong and posted the working code for the community's benefit. void uploadFile() { Serial.println("Running Upload_file: "); HTTPClient http; File file = SD.open("/240x320.jpg"); if(!file) { Serial.println("Failed to open file for reading"); return; } int len = file.size(); char size[8];…
  • And I get txt file that says this on my dropbox. {"autorename":false,"mode":"add","mute":false,"path":"/Homework/math/Uploaded2.jpg","strict_conflict":false}
  • Another baby step; it creates a file and puts the options I stipulated inside it. Here is the almost working code. Code deleted, answer at the end of this thread
  • I accidently posted the entire program, which immediately changed. I am trying to upload a file here. It doesn't upload anything. It doesn't even create an empty file.
  • I figured out why it didn't like the headers, it was the spaces: but I got a new problem. After sending in the request I use a stream to upload the data. Sadly it seems to ignore said stream... Do you have any more thoughts on this?
  • I just replied, but ... so I will again...your right you need Bearer Authentication, not Basic Authentication for this to work.
  • Stop stop stop Just crashed with this line .. source Optional(["test"]) Optional("test") /test/test.004 precondition failed: " must match pattern "\A(?:(/(.|[\r\n])*|id:.*)|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.*)?))\z": file…
  • Ok, Tried this and so far so good. Works without crashing... carthage update --configuration Debug --verbose --platform iOS Is this good from an apps store deployment point of view, I don't know; well see.
  • Hi Greg, In answer to your question, in short, no. I cannot share cause it isn't that clear cut, that said I am only using a four methods... let client = DropboxClientsManager.authorizedClient! _ = client.files.download(path:sourcePath) .response { response, error in if let response = response { etc etc and let client =…
  • Thanks Greg, Here the bear bones code for your readers I put togther; it swaps two files. let randx = Int(arc4random_uniform(32768)) let sourcePathC = sourcePathB + String(randx) let client = DropboxClientsManager.authorizedClient! _ = client.files.move(fromPath: sourcePathA, toPath: sourcePathC, allowSharedFolder: false,…
  • *** STOP PRESS *** Managed to find a solution, used this code that works. _ = client.sharing.listSharedLinks(path:sourcePath,cursor:nil,directOnly:false).response(queue: DispatchQueue(label: "MyCustomSerialQueue")) { response, error2 in print("data error \(error2) source \(sourcePath) response.0 \(response?.links[0].url)…
  • Hi Greg, Printed the errors, so I try to create a shared link. It fails with ... sharing_create_linkV2 /acme201/acmeSINGLE/acmeX101.001.png error Optional([request-id abc63bdac24b4afe306dae1d] API route error - { ".tag" = "shared_link_already_exists"; }) I ask for the shared link and I get... error Optional([request-id…
  • OK, managed to find my way around it, commented out line... DropboxClientsManager.authorizeFromController(UIApplication.shared, controller: self, openURL: { (url: URL) -> Void in UIApplication.shared.openURL(url) }) Which of course I am going to need for future clients.... now I find this…
  • Would like to say this was painless and worked... but it wasn't and although I now having got it to compile and work once, just once I find myself with the report. precondition failed: A Dropbox client is already authorized: file…
  • Tried copying the entire SwiftyDropbox project into mine as well [as I do with Alamofire]. Compiled ok that time, but having put some sample code into the project it failed since it started looking for the URL scheme in the wrong place, that is with the SwiftyDropbox project, not mine. Couldn't of course add it to that…
  • Followed the instructions for a manual install instructions on Alamofire, installed working ok. Copied source and created a new group for Swifty Code included iOS source. Tried to complile and got 4 errors, all the same thing? SwiftyDropbox-master/Source/Source/PlatformNeutral/TeamRoutes.swift:647:69: Use of undeclared…
  • Great, but my project moves to the twilight zone in the meantime. When do you think Swiftydropbox will be swift 3.0 compliant and is there anything else I can do to help make this happen? Can I try Alamofire 4.0.0 with the existing Swiftydropbox? And send you back/maybe even fix some errors?
  • OK, found a couple of posts and fixed this, by adding entries to the plist file and installing dropbox app on my device. PLEASE CLOSE THIS CALL.
  • Again seeing this feature. Wrote a PERL script that gets around it, using Greg's suggestion. #!/usr/bin/perl use JSON; use Data::Dumper; $preheat = `curl -X POST https://api.dropboxapi.com/2/sharing/list_shared_links --header "Authorization: Bearer ab-YourAUTH" --header "Content-Type: application/json" --data "{}"`;…
  • Maybe a clue, was testing an app I written that uses shares; I had created around 800+ @ that point, changed the code yesterday morning to work around it, going to try it this morning perhaps, maybe put in your fix Gregory, a good suggestion. 
  • Sure, this is what I get returned, again and again and again. Body: Optional({"links": [{".tag": "file", "url": "https://www.dropbox.com/s/v2a989i8yfmmmvw/acme2048A.001.png?dl=0", "id": "id:piyP0EHNIGAAAAAAAAAAAQ", "name": "acme2048A.001.png", "path_lower": "/slidestack/acme2048a/acme2048a.001.png", "link_permissions":…
  • Yes; I checked and changed this line of code; which fixed it. Its not a good fix; I need to throttle the requests; but that I needs more coding and its been a long day :) let url = NSURL(string:"https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings") let request = NSMutableURLRequest(URL: url! ,cachePolicy:…
  • Greg, Here is an error message. operation2 completion 609 744 ticktok 102 error Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x14ea8ec70 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}},…
  • Greg, Here the code for good measure, I try and setup some reporting from the errors here. I though I was watching it, but looking at this perhaps not. It is a swift function. func createSharedLink(lePath:String, completion: (string: String?, error: ErrorType?) -> Void) { let request = NSMutableURLRequest(URL:…
  • Hi Greg. By dead space I mean the app appears to simply hang; it isn't hanging its waiting for dropbox to reply to all of its requests, replies that never it seems come back. That said it does work, if I re-run the app, just moments later it retries the requests, and gets the response that the links already exist. So the…
  • I am testing a dropbox app I have written and I running into limits it seems, although I not getting any errors, simply dead space. I am creating links to files so that I can share them, more than a hundred links @ a time? I am using the HTTP interface to do so with the call...…
  • Thanks Steve. I like the comment, your code will break :) straight to the point. Reworked it; this is better yes? Also added the check and disabled signup parameter! your help much appreciated!! var tokenDict : [String:String] = [:] func webView(webView: WKWebView, didFinishNavigation navigation: WKNavigation!) { if…
  • Thanks Gregory, Works perfectly even with the dropBox URL now, although I am not sure where I need to set the disable_signup? Need a little bit more help on that.. On a related note; here my code to parse the token,which works and is easier than yours :) although maybe I'v missed something... saving it to defaults too so…
  • Hi Gregory, Here is a code; based on an app coda tutorial by Joyce Echessa; I hope she doesn't mind me posting it here. This is the View Controller: The App Delegate is a simply the template code. I have commented out the clientID since this is a public post. If I use localhost I find the data I need in WKNavigation error…
  • Gregory, Thanks for your help! I managed to get it working, the 128 lines were in fact an invitation to sign into dropbox. I tried the URL you suggested and it was a cleaner transaction; But have as yet not managed to workout how to get the access token back if not in the error thrown by localhost within Swift. Luke