-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to upload .fit file to Strava ?? #12
Comments
I am also running into quite some issues when I attempt to upload a new activity to Strava. For now I don't even want to include a file, I just want to create a new activity (e.g. running 5km). So far, I always get a 400 (Bad Request) response from Strava. |
@frogg Are you able to create a new activity? If yes, can you please share your code. As I am also trying to create a new activity but got errors. |
I didn't check about the .fit file itself yet but I am able to contribute basic session info to starve. Example: Ended up using this lib instead: See my PR here how to update it: |
Thanks for your reply. I have created an activity using alamofire by hitting the url and passing the parameters. Can you please help me in the authorization callback domain because strava don't let anyone add the custom url like myapp:// (This field must be a domain, no slashes or path). But the safari needs an url scheme with colon, slashes to open the app on return from the authorization. When I have checked the code of this example, I come to know that the given redirect uri also contains ://. So how can I register my application redirect uri ? |
@AnshulIronNetwork I can't help on the upload but https://stackoverflow.com/a/65092728/14414215 this is how I managed to get redirectUri to work. could you share how you created the activity? I am having trouble on the syntax to call for the upload. (There isn't an example in the readme.md or the example app) @frogg I checked out StravaZpot but the syntax is a little bit hard for me and there wasn't an example project for me to refer to within it. You mentioned you managed to contribute a basic session. Could you share how you called the Instance? Thanks |
Use my fork of StravaZpot instead, the original repo doesn't seem to get any recent updates (indeed it has been archived by the author): |
@frogg Thank for your repo link. I read thru the original repo and truth be told, I'm a bit stumped as to how to integrate it into my project. In fact, I don't even know where to start. (Newbie) in fact, it says this in bold -> you are responsible for calling this code in a suitable thread, outside the UI thread. and I'm not even sure how to begin. Would appreciate any help or an example project like what StravaSwift offers. |
I‘d recommend looking into the documentation of dispatch queues: The use for this is pretty simple: DispatchQueue.global(qos: .background).async {
// make calls to the Strava API, they are now on a background thread
} and then to upload a GPX file: let gpxFileUrl = session.generateGPXFile()
let uploadAPI = UploadAPI(client: client)
let fileUpload = uploadAPI.upload(file : gpxFileUrl,
withFilename : gpxFileUrl.lastPathComponent,
withDataType : .gpx,
withActivityType : .rockClimbing,
withName : "\(ClimbingBusinessLogic.title(forClimbingType: session.climbingType)) Session",
withDescription : "\(session.sessionDescription())\n\nTracked with Redpoint, https://redpoint-app.com",
isPrivate : false,
hasTrainer : false,
isCommute : false,
withExternalID : session.uuid.uuidString) |
@frogg I'll read up on the DispatchQueue. I'm still wrapping my head around the auhenticationController and where to put it. In codes I've seen, looks like simplest would be to put it into appDelegate.swift and create it like a singleton (similar to StravaSwift) and then use the shared instance everywhere else? Again thanks. I'll bang my head on the wall a few more days and see if I can get anywhere. |
No description provided.
The text was updated successfully, but these errors were encountered: