Tag: networking

iOS以编程方式在AP模式下设置设备

在应用生命周期中,设备如何进入接入点模式? 就像打开Personal Hotspot一样。 是否有可能在运行时分配SSID到该networking?

AFNetworking域= NSURLErrorDomain代码= -1001“请求超时”

当我第一次请求蜂窝数据不工作时,我启动我的应用程序,我有域= NSURLErrorDomain代码= -1001(请求超时)。 所有的工作都很好在Wifi。 当我与蜂窝数据重试所有的作品。 只有第一个请求不起作用。 感谢帮助。

AFNetworking发送不兼容的块指针types

我正在使用AFNetworking通过Windows身份validation访问URL。 我正在使用ASIHTTPRequest来login,如下所示: -(BOOL)User:(NSString *)user andPassWordExists:(NSString *)password { NSURL *url = [NSURL URLWithString:kIP]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setUseSessionPersistence:YES]; [request setUseKeychainPersistence:NO]; [request setUsername:user]; [request setPassword:password]; [request setDomain:@"domain"]; [request startSynchronous]; NSError *loginError = [request error]; if(loginError == nil){ return true; }else{ return false; } } 现在我正在尝试用AFNetworking来做同样的事情,这是我从这个例子中得出的结果: http ://www.raywenderlich.com/forums/viewtopic.php?f=2&t=18385 -(BOOL)User:(NSString *)user andPassWordExists:(NSString *)password { NSURL *url = […]

什么减缓GKSession的networking吞吐量?

我实现了一个应用程序,根据Ray Wenderlich关于GKSession的教程和Matt Ghallagher关于audiostream的教程 ,从一个iphone实时播放音乐到另一个。 一切工作完美..直到我们已经决定用我们自己的replace扑克游戏的用户界面。 结果突然间networking吞吐量急剧下降。 下面是一个探查器快照的服务器 这里是原始应用程序的客户端的快照 这里是更新后的用户界面的应用程序的快照(主机是旧的一样): 有一件事要记住,我们不只是改变用户界面..我们也改变了一些networking代码..这是我认为是放缓的东西(我做了很多的性能testing在用户界面上。消除所有的花里胡哨和我得到同样的减速) 有任何想法吗? 有人build议保持一个GKSession广播可用性放慢了一点事情..我确信,这不是在我的应用程序的情况下.. 更新:在看networking分析(使用仪器)后,似乎有一个未知的过程有很多的networking活动..有没有办法来检测这个未知的过程? 这是好的应用程序的屏幕截图: 这里是坏的应用程序的屏幕截图: 注意到两者之间的区别:在另一个使用比其他更多的networking活动..想法?

如何使用AFJSONRequestOperation返回一个响应对象

我试图通过使用AFJSONRequestOperation获取天气数据。 问题是我不能在查询完成时返回对象。 有没有人知道如何做到这一点? 我目前的实施是 – (NSDictionary *)getCityWeatherData:(NSString*)city { NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://free.worldweatheronline.com/feed/weather.ashx?key=xxxxxxxxxxxxx&num_of_days=3&format=json&q=%@", city]]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) { NSDictionary *data = [[JSON objectForKey:@"data"] objectForKey:@"weather"]; return data; } failure:nil]; [operation start]; }

Android / iOS客户端使用WCF双工服务

我正在尝试构build一个为Android / iOS客户端提供API的服务器/ Web服务。 我正在使用WCF服务,客户端可以成功向服务器发送请求。 现在,我打算让服务器启用ping客户端来通知服务器和客户端需要一些更改来同步数据。 问题是:是否有可能使我的服务器ping客户端(Android / iOS),我知道它是可能的Windows客户端通过使用wsDualHttpBinding,但我不知道iOS和Android客户端。 任何人都可以帮我清楚一点? 任何解决scheme是赞赏。

AFNetworking返回400个不好的请求

我想通过AFNetworking发布图片,这里是代码 AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"]; manager.responseSerializer = [AFHTTPResponseSerializer serializer]; manager.requestSerializer = [AFHTTPRequestSerializer serializer]; [manager POST:URL parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData){ [formData appendPartWithFileData:UIImageJPEGRepresentation(selfPhoto, 1) name:@"file" fileName:imageFilePath mimeType:@"image/jpg"]; } 但是返回400个不好的请求,这里是errro: Domain = com.alamofire.error.serialization.response Code = -1011“Request failed:bad request(400)”UserInfo = {com.alamofire.serialization.response.error.response = {URL: http ://121.42.203.122 :8080/8分钟/ uploadImg } {状态码:400,标题{连接=closures; “Content-Language”= en; “Content-Length”= 1105; “Content-Type”=“text / […]

NSTimer没有及时解雇

我试图连接到一个给定的IP地址端口。 一个问题是当build立一个不存在IP地址的连接时,write命令(如下): NSData * imageRequest = [@"640" dataUsingEncoding: NSUTF8StringEncoding]; int image = [self.outputImageStream write:[imageRequest bytes] maxLength:[imageRequest length]]; 它需要超过75秒的回应。 我尝试通过下面的方法调用来启动一个计时器: self.connectionTimeoutTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(respondToTimer:)userInfo:nil repeats:NO]; 它在我定义的1秒间隔内没有被调用。 有什么办法可以确保定时器在1秒内发射?

如果Wi-Fi也在IOS中连接,如何通过蜂窝networking发送数据

我正在一个ios应用程序,我需要始终通过蜂窝networking发送数据,无论设备是否连接到Wi-Fi或没有连接。如果Wi-Fi没有连接,那么一切正常,但是当Wi-Fi连接,然后数据通过Wi-Fi通道,我认为它是连接状态下数据传输的默认通道。当Wi-Fi连接和活动时,如何强制数据通过蜂窝networking发送。 我不想提示用户禁用Wi-Fi。

pipe理enqueueBatchOfHTTPRequestOperationsWithRequests AFHTTPClient子类

我想要实现来自Web服务的AFNetworking和这个AFHTTPClient子类的多个Json请求来创build一个表视图。 我将在MainViewController中创buildtableView。 #import "AFHTTPClient.h" @interface YlyHTTPClient : AFHTTPClient + ( YlyHTTPClient *)sharedHTTPClient; – (id)initWithBaseURL:(NSURL *)url; @end #import "YlyHTTPClient.h" static NSString * const urlString = @"http://localhost/example/"; @implementation YplyHTTPClient + (YlyHTTPClient *)sharedHTTPClient { static YeeplyHTTPClient *_httpClient = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ _httpClient = [[YlyHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:urlString]]; [_httpClient setParameterEncoding:AFJSONParameterEncoding]; [_httpClient registerHTTPOperationClass:[AFJSONRequestOperation class]]; }); return _httpClient; […]