我的应用程序中有一个搜索栏,用户可以输入一个地址,它会产生地理编码结果.根据以下代码,结果将根据用户类型进行更新:
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
...
if (self.geocoder.geocoding) [self.geocoder cancelGeocode];
[self.geocoder geocodeAddressString:searchText completionHandler:^(NSArray *placemarks, NSError *error) {
if (error != nil) {
NSLog(@"ERROR during geocode: %@", error.description);
return;
}
//update the view
}];
}
Run Code Online (Sandbox Code Playgroud)
这适用于用户输入搜索字段的前几个字符.但是,在用户重复输入更多字符后,地理编码器开始出现以下错误(我知道这意味着网络存在问题):
ERROR during geocode: Error Domain=kCLErrorDomain Code=2 "The operation couldn’t be completed. (kCLErrorDomain error 2.)"
Run Code Online (Sandbox Code Playgroud)
在重新加载整个ViewController之前,地理编码器不会再次运行.为什么会发生这种情况,我该怎么做才能解决它?
我从file_get_contents()php中的函数获取文件内容,我想将该文件存储在特定的文件夹中.我该怎么办?
$image = file_get_contents('http://www.affiliatewindow.com/logos/1961/logo.gif');
Run Code Online (Sandbox Code Playgroud)
我想将此图像保存在特定文件夹中.
有什么想法吗?
我想创建一个可以出现在mac菜单栏上方的NSWindow(或其他东西).我知道这是可能的,因为TeamViewer使用"鼠标"图像来完成它.
示例:http://i.stack.imgur.com/6iZbG.png
他们是如何做到的呢?(或者,我该怎么办?)