3

I am working with an application for iPhone in which I need to show the POIs pins for different locations. I need to show the callout popped up by default on first POI. I have managed to do so for iOS6 but facing problem in iOS7. I am writing my code below, it is working well with iOS6 but not on iOS7. It's not showing any error but for iOS7, I am not able to callout the popup on map POI by default.

Here is my code part :

DDAnnotation *annotation2 = [[DDAnnotation alloc] initWithCoordinate:coordinates addressDictionary:nil] ;
        annotation2.title = [[arrPOIs objectAtIndex:0] objectForKey:@"Name"];
        annotation2.subtitle = [[arrPOIs objectAtIndex:0] objectForKey:@"AmbassadorTagline"];
        annotation2.dictionaryData = [arrPOIs objectAtIndex:0];
        annotation2.strCountNumber = [NSString stringWithFormat:@"1"];

[mapView selectAnnotation:annotation2 animated:YES];
        [annotation2 release];
        annotation2 = nil;

Please gude me if you have any ideas/suggestions for this.

oefe
  • 19,298
  • 7
  • 47
  • 66
  • Is 'DDAnnotation' from https://github.com/digdog/MapKitDragAndDrop ? This hasn't been updated for years. Maybe it's not compatible with iOS 7 – oefe Oct 19 '13 at 11:33
  • please show proper code how/where did you add annotation on mapView. – AJPatel Oct 19 '13 at 13:49

3 Answers3

2

I used this code for ios7 and it's good

first

#import <MapKit/MapKit.h>

then in

ViewDidLoad

add this code

CLLocationCoordinate2D annotationCoord;
annotationCoord.latitude = someLocation;
annotationCoord.longitude = someLocation;
MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
annotationPoint.coordinate = annotationCoord;
annotationPoint.title = @"YourTitle";
annotationPoint.subtitle = @"YourSubtitle";
[map addAnnotation:annotationPoint];
  • Thanks Abdullah, i found the solution.I misses to add one line before selecting of an annotation.That is: [mapView addAnnotation:annotationPoint]; Surprisingly it was not affected for iOS6.The issue only arise for iOS7. – user2897266 Oct 25 '13 at 11:08
1

I check this method for DDAnnotaion also with simple mapView drop annotation it`s working for iOS 7. *May be possibility of following cases

1) Annotation is not visible on mapView.
2) Annotation is not yet created/added to mapView.

So please check that. or Provide full code of how and where did you add the annotation.

Please check discussion point here.for more idea.

AJPatel
  • 2,291
  • 23
  • 42
1

Thanks to all. Finally, i found the solution of my question.

I missed to add one line before selecting of an annotation.That is: [mapView addAnnotation:annotationPoint];

Surprisingly it was not affected for iOS6.The issue only arise for iOS7.