本文介绍了如何使用 Swift 在 IOS 应用程序中集成 FitBit Api的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我在 所以请指导我下一步我该怎么做才能获取数据.

解决方案

FitBit 使用 OAuth 2.0 API,需要客户端 ID 和密钥.您需要这些客户端 ID 和密钥才能使用 OAuth 2.0 API 进行身份验证.有一篇与 iOS 与 Swift 中的 FitBit 集成相关的博客文章.让我们结帐并学习如何在 iOS 中实现 fitbit"https://appengineer.in/2016/04/30/fitbit-auth-in-ios-app/

例如:

let oauthswift = OAuth2Swift(消费者密钥:fitbit_clientID,消费者秘密:fitbit_consumer_secret,authorizeUrl: "https://www.fitbit.com/oauth2/authorize",accessTokenUrl: "https://api.fitbit.com/oauth2/token",响应类型:令牌")

First of all I created an account at https://www.fitbit.comThen I careated an app at https://dev.fitbit.comthen installed OAuthSwift using cocoa pods and implemented this method in my AppDelegate

    func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
    if (url.host == "oauth-callback") {
        OAuthSwift.handleOpenURL(url)
    }
    return true
}

now i want to get the data (Name, Steps taken etc) of user account I created at https://www.fitbit.comhow can I do that ? I searched but was not able to find any tutorial on fitbit integration. And where to use this information in my code? So please guide me about next step what should I do to get the data.

解决方案

FitBit work with OAuth 2.0 API which require Client ID and Secret key. You need these client id and secret key to authenticate with OAuth 2.0 API.There is a blog post related to FitBit integration in iOS with Swift.Lets checkout and learn "How to implement fitbit in iOS"https://appengineer.in/2016/04/30/fitbit-aouth-in-ios-app/

ex:

let oauthswift = OAuth2Swift(
        consumerKey:    fitbit_clientID,
        consumerSecret: fitbit_consumer_secret,
        authorizeUrl:   "https://www.fitbit.com/oauth2/authorize",
        accessTokenUrl: "https://api.fitbit.com/oauth2/token",
        responseType:   "token"
    )

这篇关于如何使用 Swift 在 IOS 应用程序中集成 FitBit Api的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 19:02