Bug 22586 - iOS 8 Beta - ActionSheet DatePicker does not popup with DatePicker
Summary: iOS 8 Beta - ActionSheet DatePicker does not popup with DatePicker
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: iOS
Classification: Xamarin
Component: Samples ()
Version: 7.9.2.x
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Amy Burns
URL:
Depends on:
Blocks:
 
Reported: 2014-09-02 18:45 UTC by Jon Douglas [MSFT]
Modified: 2014-10-13 15:39 UTC (History)
6 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:
RESOLVED NOT_ON_ROADMAP

Description Jon Douglas [MSFT] 2014-09-02 18:45:22 UTC
Based on this sample:

http://developer.xamarin.com/recipes/ios/standard_controls/actionsheet/create_a_dismissible_actionsheet_date_picker/

One first will need to change the ViewController to the following to make sure the buttons are displayed correctly:

public ActionSheetViewController ()
		{
			Title = "Action Sheet Date Picker";

			showSimpleButton = UIButton.FromType (UIButtonType.RoundedRect);
			showSimpleButton.Frame = new RectangleF (10, 60, 300, 40);
			showSimpleButton.SetTitle ("Choose a date", UIControlState.Normal);
			showSimpleButton.TouchUpInside += (sender, e) => {
				actionSheetDatePicker.Show ();
			};
			

			dateLabel = new UILabel (new RectangleF (10, 110, 300, 40));
			dateLabel.Text = "(waiting for the date)";

			actionSheetDatePicker = new ActionSheetDatePicker (this.View);
			actionSheetDatePicker.Title = "Choose Date:";
			actionSheetDatePicker.DatePicker.Mode = UIDatePickerMode.DateAndTime;
			actionSheetDatePicker.DatePicker.MinimumDate = DateTime.Today.AddDays (-7);
			actionSheetDatePicker.DatePicker.MaximumDate = DateTime.Today.AddDays (7);			

			actionSheetDatePicker.DatePicker.ValueChanged += (s, e) => {
				dateLabel.Text = (s as UIDatePicker).Date.ToString ();
			};
			
			
			View.AddSubview (showSimpleButton);
			View.AddSubview (dateLabel);
		}

Once you run the sample on iOS 8 Beta, you will notice that the DatePicker doesn't popup and rather is broken. This however works just fine in iOS 6 and 7.

=== Xamarin Studio ===

Version 5.4 (build 178)
Installation UUID: 205770f1-e611-41a3-925c-7560f7e24eb1
Runtime:
	Mono 3.8.0 ((no/62a857e)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 308000007

=== Apple Developer Tools ===

Xcode 6.0 (6256.20)
Build 6A280n

=== Xamarin.iOS ===

Version: 7.9.4.9 (Business Edition)
Hash: 44bfd26
Branch: 
Build date: 2014-08-29 10:39:46-0400

=== Xamarin.Android ===

Version: 4.17.0 (Business Edition)
Android SDK: /Users/jondouglas/Library/Developer/Xamarin/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)
		4.5    (API level 21)
Java SDK: /usr
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.Mac ===

Version:

=== Build Information ===

Release ID: 504000178
Git revision: f52e44ab76cda9d49cde21c591c4e1f1359b4a27
Build date: 2014-08-29 11:50:58-04
Xamarin addins: b62b087979a3d4a951e7129fdeecabd0641cfadb

=== Operating System ===

Mac OS X 10.9.3
Darwin Jons-MacBook-Pro.local 13.2.0 Darwin Kernel Version 13.2.0
    Thu Apr 17 23:03:13 PDT 2014
    root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64

Please let me know if anymore details are needed
Comment 1 Rajneesh Kumar 2014-09-03 07:14:52 UTC
I have checked this issue and able to reproduce .To reproduce this I have followed the steps mentioned below:

1. Download the "ActionSheetDatePicker" from above link, provided in bud description.
2. Add the above code to "ActionSheetViewController"
3. Build and deploy the application on device (iOS 7)
4. Application will launch, click on "choose a date" a popup appear and working fine
4. Now deploy it on device (iOS 8 Beta), app will not launch
5. To launch, tap on the application and click on "choose a date" popup does't appear 
5. Application not working now.

Screencast: http://www.screencast.com/t/8O8Iy8pM

During the deploying application I observed the application out put, there was some warning and errors but I was able to reproduce the issue. The application outputs are: 
On device(iOS 7)
Application Output: https://gist.github.com/Rajneesh360Logica/0e838bc39f4d2c2330a9
On device (iOS 8 Beta)
Application Output: https://gist.github.com/Rajneesh360Logica/1d596c3345af1b81cb11


Environment Info:

=== Xamarin Studio ===

Version 5.4 (build 178)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
	Mono 3.8.0 ((detached/356dbc5)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 308109010

=== Apple Developer Tools ===

Xcode 6.0 (6256.16)
Build 6A280e

=== Xamarin.Mac ===

Version: 1.11.0.1 (Enterprise Edition)

=== Xamarin.iOS ===

Version: 7.9.2.33 (Enterprise Edition)
Hash: a910e38
Branch: 
Build date: 2014-07-07 12:30:56-0400

=== Xamarin.Android ===

Version: 4.14.0 (Enterprise 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)
		3.2    (API level 13)
		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)
		4.5    (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)

=== Build Information ===

Release ID: 504000178
Git revision: f52e44ab76cda9d49cde21c591c4e1f1359b4a27
Build date: 2014-08-29 11:50:58-04
Xamarin addins: b62b087979a3d4a951e7129fdeecabd0641cfadb

=== Operating System ===

Mac OS X 10.9.4
Darwin MacMini.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
Comment 3 Rolf Bjarne Kvinge [MSFT] 2014-09-05 11:56:38 UTC
This is because UIActionSheet does not support modifying its view hierarchy in iOS8.

Apple documents: "UIActionSheet is not designed to be subclassed, nor should you add views to its hierarchy." [1]

and the sample does this (in ActionSheetDataPicker.cs):

			actionSheet.AddSubview (datePicker);
			actionSheet.AddSubview (titleLabel);
			actionSheet.AddSubview (doneButton);

This happened to work in previous versions of iOS, but it seems like Apple changed something so that it no longer works.

In any case it's not an Xamarin.iOS bug, you'll need to implement this feature some other way in your app.

[1] https://developer.apple.com/library/ios/documentation/uikit/reference/uiactionsheet_class/Reference/Reference.html
Comment 4 Bart 2014-09-05 16:24:26 UTC
Ok, I guess I will be re-writing that part of my app. Will you guys be removing that sample or coming up with a new one using the recommended alternative of showing another view controller?
Comment 5 Rolf Bjarne Kvinge [MSFT] 2014-09-05 19:54:47 UTC
I've notified out docs team that the sample is using invalid design patterns, so they'll eventually fix it (or remove it, whatever they deem appropriate in this case).
Comment 6 Bart 2014-09-08 10:07:05 UTC
Alright. Thanks Rolf