I am getting this error:
System.NullReferenceException: Object reference not set to an instance
of an object
at MonoTouch.Design.Client.IPhoneDesignerSession +
<MaybeConvertToLatestXcode>c__async5.MoveNext () [0x0004c] in
/Users/builder/data/lanes/4470/6c2f6737/source/md-
addins/Xamarin.Designer.iOS/MonoTouch.Design.Client/
IPhoneDesignerSession.cs:774
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
[0x0000c] in /private/tmp/source-mono-d15-3/bockbuild-d15-
3/profiles/mono-mac-xamarin/build-root/mono-
x64/mcs/class/referencesource/mscorlib/system/runtime/
exceptionservices/exceptionservicescommon.cs:151
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess
(System.Threading.Tasks.Task task) [0x00037] in /private/tmp/source-
mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-
x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/
TaskAwaiter.cs:187
I cannot view my storyboard.
I think it better to address this issue to xamarin support.
For now, you can try to open your storyboard in XCode.
Related
this is the first time I'm trying to write a request to you. Normaly I had could resolve most of the problems thanks to stackoverflow and others.
I developed an Xamarin.Forms App which runs on Android perfectly but when I try to deploy it to iOS (physical iPhone 8) it keeps breaking.
After searching for hours and trying diffrent things I hope someone can read out of the Code whats the matter...
I tried as well to set breakpoints in the appdelegate or first Page but after some seconds everthing breaks with this information:
2021-08-27 18:39:24.004 Xamarin.PreBuilt.iOS[4330:1030659] Xamarin.iOS: Successfully received USB connection from the IDE on port 10000, fd: 6
2021-08-27 18:39:24.007 Xamarin.PreBuilt.iOS[4330:1030659] Xamarin.iOS: Processing: 'start profiler: no'
2021-08-27 18:39:24.007 Xamarin.PreBuilt.iOS[4330:1030624] Xamarin.iOS: Profiler not loaded (disabled)
Loaded assembly: /private/var/containers/Bundle/Application/092BCD0C-2FC9-4F1B-A83E-29D87ACD245E/SHAPP.iOS.app/Xamarin.iOS.dll [External]
2021-08-27 18:39:24.334 Xamarin.PreBuilt.iOS[4330:1030624] Xamarin.iOS: Unable to locate assembly 'SHAPP' (culture: '')
2021-08-27 18:39:24.334 Xamarin.PreBuilt.iOS[4330:1030624] Xamarin.iOS: Unable to locate assembly 'SHAPP' (culture: '')
Loaded assembly: /private/var/mobile/Containers/Data/Application/6FE32CF0-AE4D-41A2-BBBA-EAD56133AA7E/Documents/SHAPP.iOS.content/Xamarin.Forms.Core.dll [External]
2021-08-27 18:39:24.404 Xamarin.PreBuilt.iOS[4330:1030624] Xamarin.iOS: Unable to locate assembly 'FFImageLoading' (culture: '')
2021-08-27 18:39:24.404 Xamarin.PreBuilt.iOS[4330:1030624] Xamarin.iOS: Unable to locate assembly 'FFImageLoading' (culture: '')
Loaded assembly: /private/var/mobile/Containers/Data/Application/6FE32CF0-AE4D-41A2-BBBA-EAD56133AA7E/Documents/SHAPP.iOS.content/FFImageLoading.Platform.dll [External]
....
[0:] Failed to force load assembly /var/mobile/Containers/Data/Application/6FE32CF0-AE4D-41A2-BBBA-EAD56133AA7E/Documents/SHAPP.iOS.content/Forms9Patch.dll. Type:Forms9Patch.PopupLayerEffect. Exception: 'You must call Xamarin.Forms.Forms.Init(); prior to using this property.'. Callstack: ' at Xamarin.Forms.Device.get_PlatformServices () [0x00007] in D:\a\1\s\Xamarin.Forms.Core\Device.cs:87
at Xamarin.Forms.Device.GetAssemblies () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Device.cs:245
at Xamarin.Forms.DependencyService.Initialize () [0x00021] in D:\a\1\s\Xamarin.Forms.Core\DependencyService.cs:103
at Xamarin.Forms.DependencyService.Get[T] (Xamarin.Forms.DependencyFetchTarget fetchTarget) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\DependencyService.cs:28
at Forms9Patch.Settings.ConfirmInitialization () [0x00008] in C:\Users\ben\Development\Xamarin\Forms9Patch\Forms9Patch\Forms9Patch\Models\Settings.cs:116
at Forms9Patch.PopupLayerEffect..cctor () [0x00000] in C:\Users\ben\Development\Xamarin\Forms9Patch\Forms9Patch\Forms9Patch\Effects\PopupLayerEffect.cs:19 '
...
[0:] An error occurred: 'Could not create an native instance of the type 'Airbnb.Lottie.LOTAnimationView': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.'. Callstack: ' at Foundation.NSObject.InitializeObject (System.Boolean alloced) [0x0002e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:247
at Foundation.NSObject..ctor (Foundation.NSObjectFlag x) [0x0000d] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:147
at UIKit.UIResponder..ctor (Foundation.NSObjectFlag t) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/UIKit/UIResponder.g.cs:74
at UIKit.UIView..ctor (Foundation.NSObjectFlag t) [0x00000] in
...
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65
at SHAPP.iOS.Application.Main (System.String[] args) [0x00001] in C:\VisualCSharp\MyProjects\SHAPP\SHAPP.iOS\Main.cs:17
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395 '
Die App wurde beendet.
Thanks Jason and Saamer,
as you wrote i did try to fix that error prior to my request. But I could not find a way.
My AppDelegate looks like that:
using Foundation;
using Lottie.Forms.Platforms.Ios;
using UIKit;
namespace SHAPP.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
Xamarin.Forms.Forms.Init();
Forms9Patch.iOS.Settings.Initialize(this);
FFImageLoading.Forms.Platform.CachedImageRenderer.Init();
ZXing.Net.Mobile.Forms.iOS.Platform.Init();
// ObjCRuntime.Class.ThrowOnInitFailure = false;
LoadApplication(new App());
//AnimationViewRenderer.Init();
return base.FinishedLaunching(app, options);
}
}
}
So nothing to special, I did even try to set the old Lottie Init, but it did not help. As well I tryed to cancel all nuget Lottiefiles in iOS and to reinstall them, afterwards I cleaned the projects and restartet the build, same error.
Only working thing is to completly cancel Lottieusage.
The Lottie-XAML I use look's like that:
<lottie:AnimationView
Animation="14525-plumbers.json"
AutoPlay="True"
RepeatCount="3"
RepeatMode="Restart"
CacheComposition="True"
HeightRequest="500"
VerticalOptions="Start"
HorizontalOptions="Center"
IsVisible="true"
/>
If I comment it out everything works fine.
The LottieAnimationfile is in my RessourcesFolder (BundledRessource) as well as in the main folder.
Folders iOS and LottieFiles
Gentlement any ideas, what could be wrong? Thanks in advance
As Jason mentioned, you need to add that line in the AppDelegate, as you can see in this example
But you have another error too as you can read the error message at the end of the StackTrace you shared:
An error occurred: 'Could not create an native instance of the type 'Airbnb.Lottie.LOTAnimationView': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.'. Callstack: ' at Foundation.NSObject.InitializeObject (System.Boolean alloced) [0x0002e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:247
at Foundation.NSObject..ctor (Foundation.NSObjectFlag x) [0x0000d] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:147
What Lottie package are you using? Is it this one? Are you using the latest version?
You have to make sure that you add the iOS version of the Lottie package to the iOS project.
System.Threading.Tasks.TaskCanceledException: A task was canceled.
2017-11-05 14:46:31.228 Project.iOS[36807:4480015]
Unhandled Exception:
System.Threading.Tasks.TaskCanceledException: A task was canceled.
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00020] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.2.0.11/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:179
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.2.0.11/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.2.0.11/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter`
I am having hard time in handling the exception thrown by the following code when i try to debug on ios.11 emulator, but this code works fine in android.
private async Task<Plugin.Geolocator.Abstractions.Position> GetPositionAsync() {
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;
TimeSpan ts = new TimeSpan((Int32)10000);
_position = await locator.GetPositionAsync(timeout: ts);
return _position;
}
I have followed all the instructions mentioned in various websites related to #jamesmontemagno/Xamarin.Plugins/Geolocator/ but no luck. I have made sure my info.plist consist of following code:
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app needs access location when open and in the background.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Need location for geolocator plugin.</string>
<key>RequestWhenInUseAuthorization</key>
<string>Need location for geolocator plugin.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Need location for geolocator plugin.</string>
All i am trying to achieve is obtaining current location on all three platforms (IOS, Android, Windows) through Xamarin.Froms. Android is working perfectly but IOS is where i got stuck. Any type of help is appreciated.
After comparing with the official sample , I found the issue was that the timeout parameter you set is too short for the task completion, so it canceled every time.
Solution :
await locator.GetPositionAsync(TimeSpan.FromSeconds(10));
I have an application that is working fine in Debug / Release mode but, as soon as I try to deploy it via HockeyApp and VSTS, I get the following error on startup:
System.MissingMethodException: Method 'Array.Empty' not found.
at MvvmCross.Droid.Views.MvxActivityViewExtensions.OnViewCreate (IMvxAndroidView androidView, Android.OS.Bundle bundle) [0x00055] in <filename unknown>:0
at MvvmCross.Droid.Views.MvxActivityAdapter.EventSourceOnCreateCalled (System.Object sender, MvvmCross.Platform.Core.MvxValueEventArgs`1 eventArgs) [0x0000c] in <filename unknown>:0
at (wrapper delegate-invoke) System.EventHandler`1[MvvmCross.Platform.Core.MvxValueEventArgs`1[Android.OS.Bundle]]:invoke_void_object_TEventArgs (object,MvvmCross.Platform.Core.MvxValueEventArgs`1<Android.OS.Bundle>)
Also, I've noticed that if I try to use the following code:
var t = Array.Empty<object>();
VSTS is unable to compile my project, with the same error (System.MissingMethodException: Method 'Array.Empty' not found.)
I'm starting to create an app using MvvmCross. So far I have an version for Android and for WP running. Unfortunately, creating the app for iOS isn't easy. When running the iOS-app in the simulator, I only get a black screen. In MonoDevelop's Application Output is see the following exception:
2013-01-07 10:42:20.506 BestSellersTouch[319:21e03] mvx: Diagnostic: 0.09 Exception masked MissingMethodException: Method not found: 'System.Type.op_Equality'.
at Cirrious.MvvmCross.Touch.Views.Presenters.MvxTouchViewPresenter.CreateView (Cirrious.MvvmCross.Views.MvxShowViewModelRequest request) [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.Views.Presenters.MvxTouchViewPresenter.Show (Cirrious.MvvmCross.Views.MvxShowViewModelRequest request) [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.Views.MvxTouchViewDispatcher+<>c__DisplayClass4.<RequestNavigate>b__3 () [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.Views.MvxTouchUIThreadDispatcher+<>c__DisplayClass1.<InvokeOrBeginInvoke>b__0 () [0x00000] in <filename unknown>:0
2013-01-07 10:42:20.508 BestSellersTouch[319:21e03] Application windows are expected to have a root view controller at the end of application launch
Is this error causing a black screen?
References to System.Type.op_Equality only exists when an assembly is compiled against mscorlib.dll 4.0 (and later).
Current version of MonoTouch does not support 4.0 (and that member is not part of the assembly) which result in this exception at runtime.
The solution, until MonoTouch supports 4.0 (this spring) is to rebuild the assembly and make sure it referenes the mscorlib.dll that ships with MonoTouch.
The fact that this exception is thrown while presenting a view is likely the reason of your black screen (nothing got executed to show anything on it).
I want to integrate the Aviary SDK Objective-C library into Monotouch project. I use 'Monotouch Binding Project' template for this.
I have built the DLL (Thanks smart people!) The project is compiled and run on the simulator.
However I can NOT show the main Aviary view and the following code
this.afPhotoEditor = new AFPhotoEditorController(UIImage.FromFile("Images/site.jpg"));
AFDelegate afDelegate = new AFDelegate(this);
this.afPhotoEditor.Delegate = afDelegate;
this.PresentModalViewController(this.afPhotoEditor, true);
returns the error:
Unhandled Exception: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: Cannot create an NSPersistentStoreCoordinator with a nil model
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper_IntPtr_bool (intptr,intptr,intptr,bool)
at MonoTouch.UIKit.UIViewController.PresentModalViewController (MonoTouch.UIKit.UIViewController modalViewController, Boolean animated) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIViewController.g.cs:261
at TestAviary.FirstViewController.<ViewDidLoad>m__0 (System.Object , System.EventArgs ) [0x00028] in /Users/mahmood1/Projects/AviaryBinding/TestAviary/FirstViewController.cs:61
at MonoTouch.UIKit.UIControlEventProxy.Activated () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIControl.cs:30
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at TestAviary.Application.Main (System.String[] args) [0x00000] in /Users/mahmood1/Projects/AviaryBinding/TestAviary/Main.cs:17
[ERROR] FATAL UNHANDLED EXCEPTION: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: Cannot create an NSPersistentStoreCoordinator with a nil model
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper_IntPtr_bool (intptr,intptr,intptr,bool)
at MonoTouch.UIKit.UIViewController.PresentModalViewController (MonoTouch.UIKit.UIViewController modalViewController, Boolean animated) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIViewController.g.cs:261
at TestAviary.FirstViewController.<ViewDidLoad>m__0 (System.Object , System.EventArgs ) [0x00028] in /Users/mahmood1/Projects/AviaryBinding/TestAviary/FirstViewController.cs:61
at MonoTouch.UIKit.UIControlEventProxy.Activated () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIControl.cs:30
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at TestAviary.Application.Main (System.String[] args) [0x00000] in /Users/mahmood1/Projects/AviaryBinding/TestAviary/Main.cs:17
It seems this error (Cannot create an NSPersistentStoreCoordinator with a nil model) is linked with resource bundle what Aviary SDK requires to add.
From Aviary iOS Setup Guide:
4. Copy resources
Make sure AviarySDKResources.bundle is included in your target's "Copy Bundle Resources" build phase.
So I added this bundle via 'Add Existing Folder..' menu item in MonoDevelop.
Sources are placed here >>> http://www.axifile.com/en/71EC96914A
It includes 2 projects:
AviaryBinding (MonoTouch Binding Project)
TestAviary
Thank you!
Per Jonathan.Peppers comment:
Adding most files like this to your project with Build Action of Content will solve the issue.