我最近在 Appstore 中发布了我的应用程序。但是,通过调用对我的应用程序非常关键的 NSURL 在地图上添加 pin 的一项功能在 Appstore 版本中不起作用。我已经在真实设备上测试了我的应用程序,它正在工作。然而,一旦我为临时分发创建了 iPA,这个功能就不起作用了。
我刚刚创建了一个单独的线程来在地图上添加图钉,但它不起作用。这是地图上插件引脚的代码部分:
- (void)viewDidLoad
{
[super viewDidLoad];
UILongPressGestureRecognizer *lpgr=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(handleLongPress:)];
lpgr.minimumPressDuration=0.7;
[self.mapView addGestureRecognizer:lpgr];
}
-(void)handleLongPress:(UILongPressGestureRecognizer*)gestureRecognizer
{
if(gestureRecognizer.state!=UIGestureRecognizerStateBegan)
return;
CGPoint touchPoint=[gestureRecognizer locationInView:self.mapView];
CLLocationCoordinate2D touchMapCoordinate=[self.mapView convertPoint:touchPoint toCoordinateFromView:self.mapView];
lati=touchMapCoordinate.latitude;
longi=touchMapCoordinate.longitude;
NSString *newPinPoint2=[NSString stringWithFormat:@"%f,%f", touchMapCoordinate.latitude, touchMapCoordinate.longitude];
[NSThread detachNewThreadSelector:@selector(annotationHTTPRequest:) toTarget:self withObject:newPinPoint2];// added separate thread
//[self annotationHTTPRequest:newPinPoint2];// commented our
}
-(void)annotationHTTPRequest:(NSString*)theNewPoint
{
NSURL *url1=[NSURL URLWithString:url4];
NSString *newP=theNewPoint;
// 4
__weak ASIHTTPRequest *request1 = [ASIHTTPRequest requestWithURL:url1];
[request1 setCompletionBlock:^{
responseString = [request1 responseString];
[self annotationJSON:responseString second:newP ];
}];
[request1 setFailedBlock:^{
NSError *error=[request1 error];
NSLog(@"Error: %@", error.localizedDescription);
}];
[request1 startAsynchronous];
}