Saa*_*ooq 5 objective-c google-sheets ios
是否有图书馆,博客文章等可用于使用表单向Google电子表格提交数据?
我可能会写出Http POST的东西,但我想知道是否有人已经这样做,我可以利用.
这个问题就像是Android 的这个问题的iOS等价物.
Rob*_*tra 11
根据@Saad Farooq的回答,我实际上尝试编写代码
- (void)viewDidLoad
{
[super viewDidLoad];
//if there is a connection going on just cancel it.
[self.connection cancel];
//initialize new mutable data
NSMutableData *data = [[NSMutableData alloc] init];
self.receivedData = data;
//initialize url that is going to be fetched.
NSURL *url = [NSURL URLWithString:@"https://docs.google.com/forms/d/1yffvViDKq7BHALtC7Om-ceFLWT5hb_cM9sBqndHG3aU/formResponse"];
//initialize a request from url
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[url standardizedURL]];
//set http method
[request setHTTPMethod:@"POST"];
//initialize a post data
NSString *postData = @"entry.154268020=iOS&entry.940479455=vajhcsd&entry.247556683=BJKSVDB";
//set request content type we MUST set this value.
[request setValue:@"application/x-www-form-urlencoded; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
//set post data of request
[request setHTTPBody:[postData dataUsingEncoding:NSUTF8StringEncoding]];
//initialize a connection from request
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
self.connection = connection;
//start the connection
[connection start];
}
Run Code Online (Sandbox Code Playgroud)
它确实有效.你需要从@萨阿德的教程中提取的URL等在这里.顺便说一句,我是那个尝试发布以前链接的人.非常感谢告诉他的SO工作人员.
| 归档时间: |
|
| 查看次数: |
4641 次 |
| 最近记录: |