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

is it supposed to work in iOS action extensions? #4734

Closed

Description

@rshev

Trying to incorporate Mapbox into an iOS action extension (as I haven't found any information of such tries on the Internet). Outcome: the view shows only mapbox logo, (i) button, and is completely blank. One error on the console: Failed to inherit CoreMedia permissions from 14090: (null), it seems to be appearing on a try to access non-AppGroup NSUserDefaults.
Any ideas? May I help with some logs given I could turn on some verbosity/debug logging?

Platform: iOS
Mapbox SDK version: 3.2.0

Code:

        MGLAccountManager.setAccessToken("pk.XXXXXX")
        let mapView = MGLMapView(frame: self.view.bounds)
        self.view.addSubview(mapView)
        mapView.translatesAutoresizingMaskIntoConstraints = false
        mapView.topAnchor.constraintEqualToAnchor(self.view.topAnchor).active = true
        mapView.bottomAnchor.constraintEqualToAnchor(self.view.bottomAnchor).active = true
        mapView.leadingAnchor.constraintEqualToAnchor(self.view.leadingAnchor).active = true
        mapView.trailingAnchor.constraintEqualToAnchor(self.view.trailingAnchor).active = true
        mapView.showsUserLocation = true
        mapView.styleURL = MGLStyle.streetsStyleURL()
        mapView.debugMask = [.CollisionBoxesMask, .TileBoundariesMask, .TileInfoMask, .TimestampsMask]

Activity

  1. friedbunny commented on Apr 18, 2016

    @friedbunny
    Contributor

    We haven’t tested our SDK in app extensions and I would be somewhat surprised if you could get a map to draw with any of the extension flavors — memory limits are said to be quite low.

  2. added
    iOS
    on Apr 18, 2016
  3. friedbunny commented on Apr 19, 2016

    @friedbunny
    Contributor

    While it is a bug that MGLMapView’s map fails to appear in an action extension view, I don’t think fixing this problem would be worthwhile right now — the memory limits are too low.

    For example, though a MapKit view in an action extension will load and be interactive, it will immediately receive memory warnings and be killed after a few seconds.

    As an alternative to a live map, I’d suggest looking at MapboxStatic.swift, which you can use to load and display a static map image.

    For posterity, here is what MGLMapView looks like when loaded in an action extension:

    img_4168

  4. EPage-Ed commented on Apr 21, 2017

    @EPage-Ed

    I'm using a Snapshot static map in a today extension and it's working well. I'm using an AppGroup UserDefaults to share some data with the main app. This was after running into the memory limits of an extension when trying to use a live map.

  5. friedbunny commented on Jul 13, 2017

    @friedbunny
    Contributor

    Noting that Apple explicitly calls out the GL maps use case as being problematic in extensions:

    Note: Extensions have much lower per-process memory limit. Certain technologies, such as map views and SpriteKit, carry a high baseline memory cost and may be unsuitable for use in an extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugiOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions