Bug 29134 - Present Modally Adaptive Segue in storyboard causes NSInvalidUnarchiveOperationException on iOS 7
Summary: Present Modally Adaptive Segue in storyboard causes NSInvalidUnarchiveOperati...
Status: RESOLVED UPSTREAM
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.9.x (iOS 8.3)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-04-15 17:42 UTC by Jon Goldberger [MSFT]
Modified: 2015-04-22 01:57 UTC (History)
2 users (show)

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


Attachments
Test Project (19.06 KB, application/zip)
2015-04-15 17:42 UTC, Jon Goldberger [MSFT]
Details


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 UPSTREAM

Description Jon Goldberger [MSFT] 2015-04-15 17:42:26 UTC
Created attachment 10779 [details]
Test Project

## Description

Having a adaptive segue (iOS 8 feature) in a storyboard that is set to "Builds for iOS 8 and later", to get around bug 29100 ( https://bugzilla.xamarin.com/show_bug.cgi?id=29100 ) causes an NSInvalidUnarchiveOperationException when deploying to an iOS 7 device or simulator.

## Steps to reproduce

1. Load the attached test project.

2. Deploy app to iOS 7 simulator (or device)

Expected result: App will launch and display UI and you can segue to the next page by tapping the button.

Actual Result: App crashes with NSInvalidUnarchiveOperationException.


## Notes

I tried to see if this issue can be resolved by downgrading to Xcode 6.2, as is the case with bug 29100, but the issue persisted when using Xcode 6.2. 


## Stack trace

>Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidUnarchiveOperationException Reason: Could not instantiate class named UIStoryboardPresentationSegueTemplate
>  at ObjCRuntime.Runtime.ThrowNSException (IntPtr ns_exception) [0x00000] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Runtime.cs:156
>  at ObjCRuntime.Runtime.throw_ns_exception (IntPtr exc) [0x00000] in /Developer/MonoTouch/Source/maccore/runtime/Delegates.generated.cs:100
>  at at (wrapper native-to-managed) ObjCRuntime.Runtime:throw_ns_exception (intptr)
>  at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
>  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
>  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:46
>  at TestNibWithSizeClasses.Application.Main (System.String[] args) [0x00008] in /Users/apple/Downloads/TestNibWithSizeClasses/TestNibWithSizeClasses/Main.cs:17


## My environment

=== Xamarin Studio ===

Version 5.8.3 (build 1)
Installation UUID: 2dc9022f-f9a8-424f-8284-bf224cbbfde0
Runtime:
	Mono 3.12.1 ((detached/0849ec7)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312010003

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.iOS ===

Version: 8.9.1.3 (Business Edition)
Hash: f7736a4
Branch: 
Build date: 2015-04-09 04:22:08-0400

=== Xamarin.Android ===

Version: 4.20.2.1 (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		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.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 1.12.0.14 (Business Edition)

=== Build Information ===

Release ID: 508030001
Git revision: 6e8e725e0d689351901c2c70453bfa4ea25e293b
Build date: 2015-04-06 20:31:47-04
Xamarin addins: 051cd5f8c1b5dbfc87eaef80a74aec03f34c60a8

=== Operating System ===

Mac OS X 10.10.3
Darwin Jons-iMac.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 2 Jon Goldberger [MSFT] 2015-04-15 19:20:22 UTC
Additional note;

Well, I just put the storyboard from the above test project into a new Xcode project in Xcode 6.3 and got the same exception, so this seems to be an upstream issue.

Whether using XCode or XS, changing the segue to be a Modal segue rather than a Present Modally segue resolves the issue. 

However in Xcode, setting the "Builds for " property of the storyboard to "Project Deployment Target" (or "iOS 7 and later") from "iOS 8.0 or later" allows the test project to run on both iOS 7 and 8 simulators, but this is not currently an option for Xamarin Studio due to bug 29100.
Comment 3 Sebastien Pouliot 2015-04-15 21:46:58 UTC
Yes, you're diagnostic sounds right. A few more details that might prove useful...

Our latest XS releases ships with templates that are based on iOS 8.0 since it's what most _new_ projects will target.

IOW if you use "Project Deployment Target" then the value from the templates (deployment target) will be used (and that will be iOS 8.0). That allows some new features that did not exists in earlier iOS releases (like 7.x).

Error like "Objective-C exception thrown.  Name: NSInvalidUnarchiveOperationException" comes from the native/ObjC side. It's often those cases that we confirm (like you did) on Xcode because they are often identical (and not related to Xamarin).

In this case "NSInvalidUnarchiveOperationException" means that iOS 7.1 cannot understand some information in the storyboard file and decided to give up.
Comment 5 Jon Goldberger [MSFT] 2015-04-22 01:57:51 UTC
I tested this with the new Xcode 6.3.1 and the issue still exists on Apple's side.