小编zeb*_*bra的帖子

locationManager didFailWithError

从1周起,如果我的gps应用程序无法检索信号(例如:在我家测试)我没有收到任何aler.我以这种方式设置了错误通知

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {      NSString *errorType = (error.code == kCLErrorDenied) ? 
@"Access Denied" : @"Errore sconosciuto"; 
UIAlertView *alert = [[UIAlertView alloc] 
                      initWithTitle:@"Errore recuperando la Location" 
                      message:errorType 
                      delegate:nil 
                      cancelButtonTitle:@"Okay" 
                      otherButtonTitles:nil]; 
[alert show]; 
[alert release]; 
} 
Run Code Online (Sandbox Code Playgroud)

为什么应用程序不检索数据,并没有显示警报弹出窗口?

iphone uialertview iphone-sdk-3.0 cllocationmanager didfailwitherror

12
推荐指数
1
解决办法
2万
查看次数

cllocation和mkreversegeocoder

我试图用cllocation和mkreversegeocoder来修改城市名称.在我的viewdidload方法我istance cllocationmanager:

self.locManager = [[CLLocationManager alloc] init];
locManager.delegate = self;
locManager.desiredAccuracy = kCLLocationAccuracyBest;
[locManager startUpdatingLocation];
Run Code Online (Sandbox Code Playgroud)

之后:

- (void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation 
*)newLocation
fromLocation:(CLLocation *)oldLocation {
//some code to retrieve my information

MKReverseGeocoder *geoCoder = [[MKReverseGeocoder alloc]     
initWithCoordinate:newLocation.coordinate ];
geoCoder.delegate = self;
[geoCoder start];
}

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark  
*)placemark
{
MKPlacemark *myPlacemark = placemark;
citta.text = [placemark locality];
}

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error{
citta.text =@ "Unknow";
Run Code Online (Sandbox Code Playgroud)

应用程序仅在我第一次获得我的价值时起作用.在第二次应用程序崩溃.我认为是因为地理编码器已启动,我认为我必须只有一个运行.(但我真的不是这个......).在哪种方式我可以控制地理编码器正在运行?

我已经看到我可以使用cllocationcoordinate2d在我的viewdidload中使用mkreversegeocoder但是...以这种方式我可以检索newlocation.coordinate?

我已经部分解决了将地理编码器声明为类变量并进行检查的问题

if (self.geocoder != nil) {
   [geocoder release];
}
Run Code Online (Sandbox Code Playgroud)

但是....如果在我的

- …
Run Code Online (Sandbox Code Playgroud)

iphone cllocationmanager cllocation mkreversegeocoder

3
推荐指数
1
解决办法
9177
查看次数

perl,dbi与sql语句具有相似的条件

在我的代码中,我必须做一个类似条件的简单SQL查询.我是这样做的

my $out = "/Users/zero/out.log";
my $filename = "/Users/zero/data.txt";


my $dbh = DBI->connect("DBI:Oracle:sid=$sid;host=$host;port=$port", $user, $pwd) or die "Couldn't connect to database: " . DBI->errstr;
my $query = "select SOMETHING from SOMETHING_1 where SOMETHING like ?||'%' ";
my $sth = $dbh->prepare($query) or die "Connection Error: " . $dbh->errstr;
open (IN,"< $filename") or die("Unable to open $filename");        
my @righe = <IN>;
close IN;
open (OUT,">$out") or die "Unable to open $out";
foreach my $riga (@righe) {
        chomp $riga;
        (my $valore) = split …
Run Code Online (Sandbox Code Playgroud)

sql perl dbi sql-like

3
推荐指数
1
解决办法
5708
查看次数

iOS在NSUserDefaults中存储UISegmentedControl选项

有没有办法将UISegmentedControl值存储到NSUserDefaults中?我应该像NSUserDefaults中的整数值一样使用它吗?

iphone nsuserdefaults uisegmentedcontrol

3
推荐指数
1
解决办法
620
查看次数

添加uiswich作为导航项

以哪种方式我可以通过编程方式添加uiswitch作为导航项或btw在我的导航栏上?我疯了:D

iphone uinavigationbar uiswitch

2
推荐指数
1
解决办法
2881
查看次数

检查dynamodb中唯一的hash_key - python

我正在尝试使用 boto 检查 dynamodb 中 hash_key 的存在(如果存在,我无法更新我的文件)我尝试查询

   for i in self.table.query(hask_key=[value]):
      print i['url']
Run Code Online (Sandbox Code Playgroud)

但我想念一个论点(???)。我尝试过扫描,但我需要检查我的 hash_key,而不是属性。

我已经尝试过 get_item 但如果 hash_key 不存在,我将无法管理响应。

有什么建议吗?

我玩过 redis,它有存在的方法。

python boto amazon-dynamodb

2
推荐指数
1
解决办法
9552
查看次数

iOS tableview数据更改

我有一个UITableView没有问题的方法.如果我去设置页面,更改一些设置并返回我的rootview我用新设置调用方法,但我的UITableView显示始终是最后的值.有帮助吗?

iphone uitableview tableview

0
推荐指数
1
解决办法
1337
查看次数