Bug 39858 - Simulator no longer has access to AppGroup folder (NSFileManager.DefaultManager.GetContainerUrl returns null);
Summary: Simulator no longer has access to AppGroup folder (NSFileManager.DefaultManag...
Status: RESOLVED DUPLICATE of bug 59379
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: XI 9.8 (tvOS / C7)
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Xcode9.1
Assignee: Jeffrey Stedfast
URL:
Depends on:
Blocks:
 
Reported: 2016-03-23 05:47 UTC by Joseph Hanna
Modified: 2018-03-27 22:06 UTC (History)
21 users (show)

Tags:
Is this bug a regression?: Yes
Last known good build: Latest build (iOS 11) works with Xcode 8.3, but not Xcode 9. Obj-c in Xcode 9 works

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:
RESOLVED DUPLICATE of bug 59379

Description Joseph Hanna 2016-03-23 05:47:20 UTC
Description of Problem:
The Simulator can no longer access the AppGroup folder - after 3 hours of messing with provisioning profiles (thinking I stuffed something up), I concluded it wasn't me!

NSFileManager.DefaultManager.GetContainerUrl returns null. This used to work.  It seems like the entitlements are not included in the build for the simulator but I can't be sure. The Debug | Simulator profile has the Entitlements.plist configured.  The physical device works fine - it's only the simulator.

Steps to reproduce the problem:
1. Configure AppGroup "group.xxxx.xxxx" on developer.apple.com, generate provisioning profile and install
2. Set XS Build Configuration to Debug | iPad X
3. Run the app that calls NSFileManager.DefaultManager.GetContainerUrl("group.xxxx.xxxx")


Actual Results:
When run on the simulator, result is null.  
When run on the device, the result is a valid folder path.

Expected Results:
A valid folder path on the simulator.  This used to work fine.

How often does this happen? 
Every time I try to run the app on the simulator.

This happens in both XS 5 and XS 6 and on three different machines.

Additional Information:
=== Xamarin Studio ===

Version 6.0 (build 4801)
Installation UUID: d1083ad0-dee3-4099-a529-37f782026501
Runtime:
	Mono 4.4.0 (mono-4.4.0-branch/f8474c4) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404000040

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.3 (10183.3)
Build 7D175

=== Xamarin.Mac ===

Version: 2.8.0.58 (Business Edition)

=== Xamarin.iOS ===

Version: 9.8.0.58 (Business Edition)
Hash: fa3b68c
Branch: master
Build date: 2016-03-09 11:44:54-0500

=== Xamarin.Android ===

Version: 6.1.0.16 (Business Edition)
Android SDK: Not found

=== Xamarin Android Player ===

Not Installed

=== Build Information ===

Release ID: 600004801
Git revision: f73f730c738baf8701a5892b7af64fd468d1dc0c
Build date: 2016-03-14 14:28:06-04
Xamarin addins: 3af7be6c701eb0137645a03e38b82f23b65738c3
Build lane: monodevelop-lion-cycle7

=== Operating System ===

Mac OS X 10.11.4
Darwin Josephs-Office-iMac.local 15.4.0 Darwin Kernel Version 15.4.0
    Fri Feb 26 22:08:05 PST 2016
    root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
Comment 1 Rolf Bjarne Kvinge [MSFT] 2016-03-28 10:15:45 UTC
@Jeff, this sounds like an MSBuild issue, can you have a look?
Comment 2 Jeffrey Stedfast 2016-03-28 17:50:34 UTC
Ah, thanks Rolf - I missed the fact that the entitlements weren't being included so it looked like a mis-file to me.
Comment 3 Jeffrey Stedfast 2016-04-06 15:21:38 UTC
this was fixed last week, guess I forgot to close it
Comment 4 Joseph Hanna 2016-04-06 20:11:25 UTC
Thanks for fixing it so quickly. When will it be released on the alpha channel?
Comment 5 Jeffrey Stedfast 2016-04-06 20:37:39 UTC
Yes, I'm just not sure when the next alpha release will go out.
Comment 6 Joseph Hanna 2016-04-27 01:28:40 UTC
Hi @jeff, just noticed that the Alpha channel has been promoted to beta, but it does not include the entitlement fixes (this bug, https://bugzilla.xamarin.com/show_bug.cgi?id=40318 and https://bugzilla.xamarin.com/show_bug.cgi?id=40572).

These are critical!
Comment 7 Jeffrey Stedfast 2016-04-27 21:20:14 UTC
They should be fixed in the RC that went out today
Comment 8 Joseph Hanna 2016-05-01 01:38:44 UTC
Thanks Jeff.  We are almost there.  A new bug along the same lines has appeared.  I have created a separate ticket for it: https://bugzilla.xamarin.com/show_bug.cgi?id=40769
Comment 9 James Neno 2016-10-26 15:21:33 UTC
I am seeing this issue using the latest release version of Xamarin Studio (6.1.1, Build 15).

Is the fix still pending?

Thanks!

For reference:

Steps to reproduce the problem:
1. Configure AppGroup "group.xxxx.xxxx" on developer.apple.com, generate provisioning profile and install
2. Set XS Build Configuration to Debug | iPad X
3. Run the app that calls NSFileManager.DefaultManager.GetContainerUrl("group.xxxx.xxxx")
Comment 10 Joseph Hanna 2017-09-25 11:08:52 UTC
I would like to re-open this bug as it has reappeared in VS 7.1.5, Xamarin.iOS 11.0.0.0, Xcode 9 and both iOS 10.3.1 and iOS 11 simulators.  When I revert back to Xcode 8.3.3 SDK and keep the same Xamarin stack, it works.
Comment 11 Andy 2017-09-25 14:52:05 UTC
Yes I am seeing this issue with Xcode 9.
Comment 12 Sebastien Pouliot 2017-09-26 12:43:23 UTC
@Jeff the fix for https://bugzilla.xamarin.com/show_bug.cgi?id=59379 was merged into `xcdeo9` so it's part of XI 11.0. If this issue still exists then something else is incorrect.
Comment 13 Jeffrey Stedfast 2017-09-26 16:45:24 UTC
Joseph, Andy: could you attach build logs? Please do a Build/Clean first so that it does a complete (fresh) build. Thanks.
Comment 14 Jeffrey Stedfast 2017-09-26 16:46:41 UTC
Oh, and please go into your Visual Studio for Mac Preferences and enable "Diagnostic" level MSBuild logs in the "Projects/Build" section. Thanks!
Comment 15 Dennis Welu 2017-09-29 15:03:24 UTC
Also just discovered this issue with all the latest stuff installed. Interestingly, my iPhone7 10.3.1 simulator, which maintained its state through the install of new XCode and additional simulators and has my app installed on it already, still returns a good value for GetContainerUrl. It's just any new simulator that I try that has the problem...
Comment 16 Mikalai Daronin 2017-10-02 15:58:55 UTC
It still occurs with Xamarin.iOS 11.0.0.0 and Xcode9.
Comment 17 Sarah Tolsma 2017-10-03 21:01:03 UTC
Seeing the same issue for our app. Install details:

Visual Studio Community 2017 for Mac
Version 7.1.5 (build 2)
Installation UUID: 80d335b8-8e5b-4533-8c23-9ecbf4429676
Runtime:
	Mono 5.2.0.224 (d15-3/14f2c81) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 502000224

NuGet
Version: 4.3.0.2418

.NET Core
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	1.1.1
	1.0.4
SDK: /usr/local/share/dotnet/sdk/1.0.3/Sdks
SDK Version: 1.0.3
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks

Xamarin.Profiler
Version: 1.5.5
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Apple Developer Tools
Xcode 9.1 (13526)
Build 9B37

Xamarin.iOS
Version: 11.0.0.0 (Visual Studio Community)
Hash: 152b654a
Branch: xcode9
Build date: 2017-09-15 02:25:56-0400

Xamarin.Android
Version: 7.4.5.1 (Visual Studio Community)
Android SDK: /Users/Sarah/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		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)
		5.1    (API level 22)
		6.0    (API level 23)
		7.0    (API level 24)
		7.1    (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.3
SDK Build Tools Version: 26.0.1

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Xamarin Inspector
Version: 1.3.1
Hash: cbc48dd
Branch: 1.3-release
Build date: Thu, 21 Sep 2017 19:52:53 GMT
Client compatibility: 1

Xamarin.Mac
Version: 3.6.3.3 (Visual Studio Community)

Build Information
Release ID: 701050002
Git revision: 7afedcaef8e7542e70e3cf8f9bdb26938b8c0876
Build date: 2017-09-15 08:39:58-04
Xamarin addins: 3262aadf811a18c12eac6742532d052b0139a808
Build lane: monodevelop-lion-d15-3-xcode9

Operating System
Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
    Thu Jun 15 17:36:27 PDT 2017
    root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
Comment 18 Rolf Bjarne Kvinge [MSFT] 2017-10-05 15:45:08 UTC
This looks like a dup of bug #59379 (which we'll try to fix for the same-day release corresponding with Xcode 9.1)

*** This bug has been marked as a duplicate of bug 59379 ***
Comment 19 Jonathan ANTOINE 2017-10-11 17:19:09 UTC
Hello,

Is there a workaround to be able to test our app on a simulator :) ?

Regards
Comment 20 kyle.spearrin 2017-10-30 19:56:00 UTC
Same issue here. Can no longer test our apps in the sim because of this. Looking for a workaround.
Comment 21 Lewis Todd 2017-11-01 16:11:54 UTC
Seeing as the bug which this is marked as a duplicate of is private, can anyone confirm if the fix for this should be in the version which is live for 11.1. I am still seeing the same problem.
Comment 22 Rolf Bjarne Kvinge [MSFT] 2017-11-02 12:13:22 UTC
@Lewis, unfortunately we haven't been able to fix this yet, but the work is in progress.
Comment 23 jeroen.bernsen 2017-11-18 13:28:34 UTC
Yes please fix ASAP. This is now also a major problem for our company not being able to use the simulator!
Comment 24 niklas.schreibikuss 2017-11-23 08:32:11 UTC
Why not fixed yet? Xamarin, it blocks us. Time is money. Please fix ASAP!
Comment 25 Joey Z 2017-11-27 19:38:29 UTC
This has been blocking my company as well.  I've been waiting for this to be fixed for a couple months.  There are work arounds (not using simulators) but they slow down development time significantly.  

Thanks
Comment 26 tmrog 2018-01-29 13:09:56 UTC
I see that the bug (59379) this is marked as a duplicate of has been resolved/fixed.  I cannot see that bug.  I just installed the latest updates (iOS 11.6.1.4) and see that it is not fixed.  What build will it be fixed in?
Comment 27 Jeff Meyerhoff 2018-03-01 05:24:02 UTC
I'm still seeing this bug. NSFileManager.DefaultManager.GetContainerUrl is null in iOS Simulator, but works on device. Visual Studio for Mac 7.3.3 (build 23), Xcode 9.2 (9C40b), iOS Simulator running 11.2. Happy to help in any way I can! jeff@jdmlabs.org
Comment 28 Eduard Schäfer 2018-03-21 18:27:18 UTC
Same here... any workarounds?
Comment 29 Eduard Schäfer 2018-03-21 18:40:30 UTC
Sorry, my fault. My iOS Bundle Signing setting "Custom Entitlements" for iPhoneSimulator was not set.

After setting it correctly to Entitlements.plist it worked.

https://stackoverflow.com/questions/26740404/containerurlforsecurityapplicationgroupidentifier-returns-nil-on-ios-simulator?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
Comment 30 Eduard Schäfer 2018-03-21 19:07:53 UTC
I was testing on iOS 9. iOS 11.2 same problem as jeff described..
Comment 31 Joseph Hanna 2018-03-21 20:00:11 UTC
This works for me now using the latest version of VS for Mac and xamarin.ios
Comment 32 Dennis Welu 2018-03-21 20:37:01 UTC
Happily I agree with Joseph this is now working for me on the latest.
Comment 33 Dennis Welu 2018-03-27 22:06:02 UTC
So strange...maybe it's not working. The other day every simulator/version I tried was working. Today, not so much. Even the ones I was using the other day. Something must have triggered it to start working previously? But then fast forward and after reboots etc. it's not working again. Dunno.