我有一段时间没有触及这个代码,所以我想知道是否有任何明显的事情会导致我遇到的问题.
我在UIAlertView执行搜索查询后向用户显示.这很好用,直到我开始在iOS 6.1上测试(或者我正在使用的这个特定的iPad 2).现在,直到作为正常解雇了UIAlertView,然后屏幕一直变暗几秒钟.
这似乎不是一个问题,除了一点滞后,直到我注意到我仍然可以触摸我的应用程序中的表视图,这导致屏幕闪烁发生.
代码在我的github上:ipwnstuff/shodan
如果在objective-c中声明如何写一行怎么办呢?这有适当的风格吗?
我知道用于赋值(int a = condition ? b : c)的三元运算符,但是我想调用一个方法是if(condition){ [self methodCall]; }推荐的方法来处理这一行吗?
另外还有objc风格指南吗?(想想与这个红宝石风格指南相比)在一段时间没有触及它之后回到语言让我想重新思考我如何设计我的代码.
我UIAlertView在我的应用程序中添加了一个抓取用户输入,但我不确定如何添加第三个按钮.理想情况下,三个按钮将水平跨越警报,或者两个按钮位于"取消"按钮上方.下面的代码片段是我用来添加的代码片段UIAlertView.
- (IBAction)initiateSave{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Archive"
message:@"Enter a name to save this as:"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Save Session",@"Save",nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField * alertTextField = [alert textFieldAtIndex:0];
alertTextField.keyboardType = UIKeyboardTypeDefault;
alertTextField.placeholder = @"eg. My awesome file...";
alert.tag = 1;
[alert show];
[alert release];
self.name = [[alert textFieldAtIndex:0]text];
}
Run Code Online (Sandbox Code Playgroud)

是否有任何节点模块可以在内存中创建 zip?(我不想将 zip 文件保存在磁盘上),以便我们可以将这个创建的 zip 文件发送到其他服务器(从内存)。做这个的最好方式是什么?这是我的例子:
var file_system = require('fs');
var archiver = require('archiver');
var dirToCompress = 'directoryToZIP';
module.exports = function (req, res, next) {
var archive = archiver.create('zip', {});
archive.on('error', function (err) {
throw err;
});
var output = file_system.createWriteStream('/testDir/myZip.zip',{flags:'a'});//I don't want this line
output.on('close', function () {
console.log(archive.pointer() + ' total bytes');
console.log('archiver has been finalized and the output file descriptor has closed.');
});
archive.pipe(output);
archive.directory(dirToCompress);
archive.finalize();
};
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用NSURLConnection的委托方法.目前尚未调用以下方法:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection;
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
//I also want to be able to use self-signed https urls
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace;
//I also want to be able to use self-signed https urls
Run Code Online (Sandbox Code Playgroud)
我目前正在使用同步调用,但异步似乎更好,因为在我完成代码库后,我将把它实现到iPhone应用程序中,我不能让我的ui冻结.
用以下方法responseData = [NSMutableData dataWithData:[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]];
我得到了我需要的数据但是使用异步我似乎必须使用委托方法来获取数据.我尝试使用添加委托@interface myClass : NSObject<NSURLConnectionDelegate>
我正在调用我的方法如下:
-(void)grabData{
NSArray* array = [NSArray arrayWithObjects:@"auth.login",@"user",@"pass", nil];
NSData* packed_array = [array messagePack];
NSURL* url = [NSURL URLWithString:@"https://192.168.1.115:3790/"];
NSMutableURLRequest* request = [[[NSMutableURLRequest alloc]initWithURL:url]retain];
[request setHTTPMethod:@"POST"]; …Run Code Online (Sandbox Code Playgroud)