我最近在Appstore中发布了我的应用程序。但是,通过调用对我的应用程序非常关键的NSURL在地图上添加pin的一个功能在Appstore版本中不起作用。 我已经在真实设备上测试了我的应用程序,它正在运行。无论如何,一旦我为adhoc发布创建了iPA,这个功能就无效了。
我刚创建了一个separete线程,用于在地图上添加pin,但它无效。以下是地图上addin pin的代码部分:
- (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];
}