我正在尝试创建我的第一个pod并遵循本教程:http: //www.sitepoint.com/creating-cocoapods/
但当我这样做时:
pod spec lint GLLingoManager.podspec
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
$ pod spec lint GLLingoManager.podspec
-> GLLingoManager (0.1.0)
- ERROR | [OSX] unknown: Encountered an unknown error ([!] /Applications/Xcode.app/Contents/Developer/usr/bin/git clone https://github.com/xeppen/GLLingoManager.git /var/folders/v6/tdz6zc7j10j_k0pc1vy627zm0000gn/T/d20160504-76297-8l71fj --template= --single-branch --depth 1 --branch 0.1.0
Cloning into '/var/folders/v6/tdz6zc7j10j_k0pc1vy627zm0000gn/T/d20160504-76297-8l71fj'...
warning: Could not find remote branch 0.1.0 to clone.
fatal: Remote branch 0.1.0 not found in upstream origin
) during validation.
Analyzed 1 podspec.
[!] The spec did not pass validation, due to 1 error.
Run Code Online (Sandbox Code Playgroud)
我不明白什么是错的.我该怎么办?
我正在尝试使用JSch将两个文件上传到使用SFTP的服务器.如果目录为空,它可以正常上传文件,但我想一遍又一遍地上传相同的文件(只是更改内部的ID),但我无法弄清楚如何做到这一点.JSch中有一些名为OVERWRITE的静态参数,但我无法找到如何使用它.
任何人都想告诉我应该如何添加此设置?
这是我目前的代码:
public void upload() {
try {
JSch jsch = new JSch();
session = jsch.getSession(SFTPUSER, SFTPHOST, SFTPPORT);
session.setPassword(SFTPPASS);
java.util.Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.connect();
channel = session.openChannel("sftp");
channel.connect();
channelSftp = (ChannelSftp) channel;
channelSftp.cd(SFTPWORKINGDIR);
File f1 = new File("ext_files/" + FILETOTRANSFER1);
channelSftp.put(new FileInputStream(f1), f1.getName());
File f2 = new File("ext_files/" + FILETOTRANSFER2);
channelSftp.put(new FileInputStream(f2), f2.getName());
channelSftp.exit();
session.disconnect();
} catch (Exception ex) {
ex.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud) 我对iOS很新,并且正在尝试执行REST请求并获取一些XML数据,解析它并理想地放入自定义对象.但是现在我仍然坚持获取XML数据.
我在Github/AFNetworking上找到了这段代码片段.
- (void) fetchInterestData{
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer = [AFXMLResponseSerializer new];
NSDictionary *parameters = @{@"foo": @"bar"};
[manager POST:@"http://www.raywenderlich.com/downloads/weather_sample/weather.php?format=json" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
}
Run Code Online (Sandbox Code Playgroud)
它工作并获取JSON对象.但我想得到XML ..
如果我使用http://www.raywenderlich.com/downloads/weather_sample/weather.php?format=xml而不是xml对象.但现在代码完全崩溃了.我希望至少将xml作为字符串对象.
我需要更改什么来获取xml并假设我想获取以下结构的xml对象:
<RootNode>
<Banks>
<Bank>
<BankId>17</BankId>
<BankName>Bluestep</BankName>
<BankUrl>http://www.bluestep.se</BankUrl>
<BankImage>
http://smartkalkyl.se/smartfiles/layout/banklogos/bluestep.png
</BankImage>
<Rates>
<Rate>
<RateDate>2013-12-05</RateDate>
<RateType>5</RateType>
<RateInterest>6,23</RateInterest>
<RateDescription/>
<RateBefore>6,27</RateBefore>
<RateChange>False</RateChange>
<RateBeforeDate>2013-08-13</RateBeforeDate>
</Rate>
</Rates>
</Bank>
<Bank>
...
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
更新:新代码..
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
AFHTTPRequestSerializer * requestSerializer …
Run Code Online (Sandbox Code Playgroud)