Bug 26419 - MapKit not working on OS X
Summary: MapKit not working on OS X
Status: VERIFIED FIXED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: Master
Hardware: Macintosh Mac OS
: Normal major
Target Milestone: 2.0.x
Assignee: Chris Hamons
URL:
Depends on:
Blocks:
 
Reported: 2015-01-26 10:05 UTC by Mike James
Modified: 2015-03-27 10:36 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Mike James 2015-01-26 10:05:49 UTC
When running a simple MapKit sample app I get the following error: 

'Your Application has attempted to access the Map Kit API. You cannot access this API without an entitlement. You may receive an entitlement from the Mac Developer Program for use by you only with your Mac App Store Apps. For more information about Apple's Mac Developer Program, please visit developer.apple.com.'

Apple's guide suggests the following: 

In the Portal: 
1) Create an AppID with “Maps” enabled for both Development and Distribution.
2) Create the Mac Provisioning Profiles for Development and Distribution, that use this new AppID.
 
Then in Xcode:
3) Set the target’s CFBundleIdentifier to match the new AppID.
4) Select the appropriate “Team” for your target, in the “General” tab, under the “Identity” section.
5) In the “Capabilities” tab, turn on “App Sandbox” and “Maps”.  This will create and include an entitlements file in your project called “MapCallouts.entitlements” in order to link and run with MapKit.framework.

I've followed the above guide as best I can within XS. We don't have a 'Maps' entitlement within Xamarin Studio so I've assumed (perhaps incorrectly) that the Location checkbox does the same thing? 

Either way, we aren't creating MapCallouts.entitlements file and the App when running doesn't render any of the tiles. 

Sample can be found here: https://www.dropbox.com/s/k0oe3gsapr84lb0/MapKitSample.zip?dl=0
Comment 1 Rajneesh Kumar 2015-01-29 10:13:24 UTC
I have checked this issue and able to reproduce this. To reproduce this issue I have followed the steps and instruction provided in bug description.

I observed that on running attached MapKit sample app I get the following error:
"2015-01-29 20:08:49.204 MapKitSample[26562:1903] Your Application has attempted to access the Map Kit API. You cannot access this API without an entitlement. You may receive an entitlement from the Mac Developer Program for use by you only with your Mac App Store Apps. For more information about Apple's Mac Developer Program, please visit developer.apple.com."

Screencast: http://www.screencast.com/t/UGz6exzjiYKk

Application output: https://gist.github.com/Rajneesh360Logica/17052c98a10fa6fbfb09
Build Output: https://gist.github.com/Rajneesh360Logica/815423f88fe0823773de

Environment Info:

=== Xamarin Studio ===

Version 5.7.1 (build 15)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Xamarin.Android ===

Version: 4.20.0.28 (Business Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.iOS ===

Version: 8.6.1.23 (Business Edition)
Hash: 5c4bf93
Branch: 
Build date: 2015-01-27 17:37:50-0500

=== Xamarin.Mac ===

Version: 1.12.0.4 (Business Edition)

=== Build Information ===

Release ID: 507010015
Git revision: ce24e991948c7f3d88b0194a14fc1996d848ef51
Build date: 2015-01-26 16:42:20-05
Xamarin addins: 6895e3222bfa6910524708aa0633ff3db99bc3a0

=== Operating System ===

Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 Chris Hamons 2015-02-25 11:55:13 UTC
You appear to need this key:

	<key>com.apple.security.app-sandbox</key>
	<true/>


and sand boxing turned on to make things work. The MapCallouts.entitlements thing appears to be a incorrect comment, file does not exist on my system or on apps made in Xcode fwict.
Comment 3 Timothy Risi 2015-02-25 19:52:09 UTC
You don't actually need app sandboxing turned on, you just need the MapKit entitlement turned on.  We need to add the checkbox for the entitlements, but in the meantime you can hack it into the Entitlements.plist (XS uses entitlements.plist instead of <project name>.entitlements) by adding:

        <key>com.apple.developer.maps</key>
 	<true/>

My full Entitlement.plist I used to get the sample working was:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>com.apple.developer.maps</key>
	<true/>
</dict>
</plist>

Along with fixing the entitlements file (you can create your own with the above text, or if you turn on any entitlement it'll create one for you, then you just have to add the maps key to it), you have to have an app id/provisioning profile with MapKit enabled.

In Xamarin Studio:

1) Open Project Options
2) Navigate to Mac Signing
3) Select Identity
4) Select Provisioning Profile
5) For Custom Entitlements, select the Entitlements.plist file with the maps key hacked into it.
Comment 4 Timothy Risi 2015-03-13 15:23:55 UTC
Fixed on md-addins/master / c95a528e3fd6ee8796b532abfcd04168d55755e2
Comment 5 Rajneesh Kumar 2015-03-16 07:27:24 UTC
As per comment 4, currently we don't have any latest master build with 2.0.x.  also the bug milestone is set as 2.0.x , So we have checked with latest cycle 5 build and still getting same behaviour so please when  the fix build will be available in 2.0.x.

Environment Info:

=====Environment Info:===
Xamarin Studio Version 5.9 (build 222)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
Mono 4.0.0 ((detached/565c18b)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400000068
Apple Developer Tools Xcode 6.2 (6776)
Build 6C131e
Xamarin.Mac Version: 2.0.0.110 (Business Edition)
=== Build Information ===
Release ID: 509000222
Git revision: d0ebd741db1b0740fdb46e46558a10f5fc0068e1
Build date: 2015-03-16 06:08:37-04
Xamarin addins: a87d89e3612e207fe3ccc142b1c2a2eb0deff730
Operating System Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
Sun Aug 17 19:50:11 PDT 2014
root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 6 Timothy Risi 2015-03-16 13:10:30 UTC
This is a bug in md-addins, not in maccore.  It's fixed on the monodevelop-5.9-branch.
Comment 7 Chris Hamons 2015-03-26 16:45:05 UTC
Testing w/ cycle 5 latest builds (both XM and XS) should show this is fixed.
Comment 8 Rajneesh Kumar 2015-03-27 10:36:31 UTC
@Timothy, @Chris
Thanks a lot for providing the info and steps to check this issue. I have checked this issue with the following builds:

=== Xamarin Studio ===
Version 5.9 (build 310)
Installation UUID: 2939b8b4-8977-42bd-82d6-100275ccd9cd
Runtime:
Mono 4.0.0 ((detached/87c62a1)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400000116
Apple Developer Tools Xcode 6.2 (6776)
Build 6C131e
Xamarin.Mac Version: 2.0.0.174 (Starter Edition)
=== Build Information ===
Release ID: 509000310
Git revision: 5e63e3a7face15bd906106306fb4565eaf503995
Build date: 2015-03-26 12:30:38-04
Xamarin addins: 14cabb8b8f6b94fb7aac79016d64f4b9db4d0091
Operating System Mac OS X 10.9.4
Darwin 360-MACMINIs-Mac-mini-2.local 13.3.0 Darwin Kernel Version 13.3.0
 Tue Jun  3 21:27:35 PDT 2014
 root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64

I observed that MapKit is working fine on OS X. Now, I user is able to run the MapKit sample and able to load map successfully, without any issue.

Please refer the screencast: http://www.screencast.com/t/Fy1wKXLFy11l

This issue has been fixed, hence I am closing this issue.

Thanks!