Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Annotations not showed on the Map #3091

Closed
bloemy7 opened this issue Nov 20, 2015 · 5 comments
Closed

Annotations not showed on the Map #3091

bloemy7 opened this issue Nov 20, 2015 · 5 comments
Labels
bug iOS Mapbox Maps SDK for iOS

Comments

@bloemy7
Copy link

bloemy7 commented Nov 20, 2015

Hi,

I am initialising the map like this:

    #import "Mapbox.h"

    @interface ShowEtablissementViewController () <UIActionSheetDelegate,       MFMailComposeViewControllerDelegate, MGLMapViewDelegate>

    @property (nonatomic) MGLMapView *mapView;

    @end

    @implementation ShowEtablissementViewController

    - (void)viewDidLoad {
        [super viewDidLoad];
        self.mapView = [[MGLMapView alloc] initWithFrame:self.mapBoxView.bounds];
        self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        self.mapView.delegate = self;
        [self.view addSubview:mapView];
    }

If I add an annotation directly here in viewDidLoad, like this:

    MGLPointAnnotation *hello = [[MGLPointAnnotation alloc] init];
    hello.coordinate = CLLocationCoordinate2DMake(40.7326808, -73.9843407);
    hello.title = @"Hello world!";
    hello.subtitle = @"Welcome to my marker";
    [self.mapView addAnnotation:hello];

It doesn't appear on the map.

If I use the CLLocationManager, it doesn't appear either.

But if I do:

NSLog(@"%@", self.mapView.annotations);

There is an annotation. It does exist: it just isn't displayed.

(
    "<MGLPointAnnotation: 0x141c6ce00>"
)

What am I missing here? Is this a real bug or an implementation error from my part?

@1ec5 1ec5 added bug iOS Mapbox Maps SDK for iOS labels Nov 20, 2015
@1ec5
Copy link
Contributor

1ec5 commented Nov 20, 2015

This bug was most likely fixed in #2322, which will make it into the next release of the Mapbox iOS SDK. In the meantime, please refer to this workaround: #2693 (comment).

@1ec5 1ec5 closed this as completed Nov 20, 2015
@bloemy7
Copy link
Author

bloemy7 commented Nov 24, 2015

Hi,

I added the new release but the issue is still there. Am I missing something?

Thanks a lot

@1ec5
Copy link
Contributor

1ec5 commented Nov 24, 2015

Thanks for the report. This sounds like the regression we're tracking in #2956. In the meantime, the workaround above should work.

@bloemy7
Copy link
Author

bloemy7 commented Nov 24, 2015

Yep it does work. The only thing that still doesn't work is the showAnnotations method, that seems to randomly zoom in somewhere, way too close to earth, not taking into account the annotations at all...

@1ec5
Copy link
Contributor

1ec5 commented Nov 24, 2015

Please open a separate bug about showAnnotations (with details on how to reproduce the issue). Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

2 participants