Adding Google Objective-C API 'GTL' to iPhone project

后端 未结 5 676
隐瞒了意图╮
隐瞒了意图╮ 2020-12-24 03:50

How to I add the Google Drive API to my iPhone project to I can use it?

So far, I have dragged the GTL project into my current app project (so that it is nested unde

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-24 04:18

    this is does not really solve the problem of installing Google API's but in this repo I accessed Google Forms from an iOS app without using Google's API. https://github.com/goktugyil/QorumLogs

    So you may skip the installing API part in some projects

    Here is the tutorial of how to set it up: https://github.com/goktugyil/QorumLogs/blob/master/Log%20To%20GoogleDocs.md

    Heres the code to do it:

    private static var googleFormLink: String!
    private static var googleFormAppVersionField: String!
    private static var googleFormUserInfoField: String!
    private static var googleFormMethodInfoField: String!
    private static var googleFormErrorTextField: String!
    
    /// Setup Google Form links
    static func setupOnlineLogs(#formLink: String, versionField: String, userInfoField: String, methodInfoField: String, textField: String) {
        googleFormLink = formLink
        googleFormAppVersionField = versionField
        googleFormUserInfoField = userInfoField
        googleFormMethodInfoField = methodInfoField
        googleFormErrorTextField = textField
    }
    
    private static func sendError(#text: String) {
        var url = NSURL(string: googleFormLink)
        var postData = googleFormAppVersionField + "=" + text
        postData += "&" + googleFormUserInfoField + "=" + "anothertext"                
        postData += "&" + googleFormMethodInfoField + "=" + "anothertext" 
        postData += "&" + googleFormErrorTextField + "=" + "anothertext" 
    
        var request = NSMutableURLRequest(URL: url!)
        request.HTTPMethod = "POST"
        request.setValue("application/x-www-form-urlencoded; charset=utf-8", forHTTPHeaderField: "Content-Type")
        request.HTTPBody = postData.dataUsingEncoding(NSUTF8StringEncoding)
        var connection = NSURLConnection(request: request, delegate: nil, startImmediately: true)
    }
    

提交回复
热议问题