I want to implement list of different types using MvxRecyclerView and ItemTemplateSelector but I get not supported exception when I only try to show activity with MvxRecyclerView.
System.NotSupportedException has been thrown.
Could not activate JNI Handle 0x7ffc627020 (key_handle 0xc743032) of Java type 'mvvmcross/droid/support/v7/recyclerview/MvxRecyclerView' as managed type 'MvvmCross.Droid.Support.V7.RecyclerView.MvxRecyclerView'.
The same when I add binding to ItemsSource, MvxTemplateSelector or MvxItemTemplate. Nothing helps. What am I missing?
I decided to post my answer as I had the same issue in MvvmCross 8.0.2 despite using the MvvmCross.DroidX.RecyclerView.MvxRecyclerView.
The solution in my case was to add MvvmCross.Plugin.FieldBinding package to the Droid project.
Related
I try to run Quickfix\n project and I face the above error with 6846 warnings. Why does this happen ? I see that many resolve this error message by modifying the code (i mean general this error message & not especially for the project of quickfix\n) but I didn't write this code so that to be in somewhere mistake while I get the quickfix\n as project to run it
I'm using Xamarin and trying to run one of my apps in the iOS simulator but I am getting this error:
2015-10-07 12:38:02.715 MolinaCoding1iOS[1550:54337] Unhandled managed exception:
Could not initialize an instance of the type 'UIKit.UIImage': the native 'initWithContentsOfFile:' method returned nil.
It is possible to ignore this condition by setting MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure to false. (System.Exception)
How do I actually ignore this condition? If I should not ignore this...then what should I do?
Thanks
I got this problem solved by running "Clean" on my project (using Visual Studio). Right Click your project and select "Clean". Run the application afterwards.
You can ignore by adding the below statement just before you use that class/ method.
ObjCRuntime.Class.ThrowOnInitFailure = false;
I've bound an iOS library, SVGKit, to C# using Xamarin/Monotouch. After some issues I've managed to get the library to build ok.
My code can be found here: https://github.com/jamesmundy/SVGKit.Xamarin
Unfortunately, when I try to initialise a type from the class I receive the following error:
Could not initialize an instance of the type
'SVGKitBindings.SVGKFastImageView': the native 'init' method returned
nil. It is possible to ignore this condition by setting
MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure to false.
The full stack trace is can be seen here.
Any idea as to what is causing this problem and what I can do to rectify it?
Update: Here is the full Build Output of my project. http://pastebin.com/f60wFm52
Update 2: Tried setting SmartLink to false and rebuilding, same error though a slightly different build output. http://pastebin.com/ApCAz2BP
Look at the source code for SVGKFastImageView init [1]:
- (id)init
{
NSAssert(false, #"init not supported, use initWithSVGKImage:");
return nil;
}
The managed exception is correct: you can't call this constructor.
[1] https://github.com/SVGKit/SVGKit/blob/cd47ae95e57c9490a9238173855ecbe83d4aaf44/Source/UIKit%20additions/SVGKFastImageView.m#L53
I am trying to use the BoxSearchRequestBuilder class to be able to perform a search in Box via the iOS SDK (v2). When I try to instantiate a BoxSearchRequestBuilder instance with its initializer, I get a compiler error.
What I am trying to do:
BoxSearchRequestBuilder* builder = [[BoxSearchRequestBuilder alloc] initWithSearch:#"123" queryStringParameters:#{#"content_types" : #"tags"}];
The error:
receiver 'BoxSearchRequestBuilder' for class message is a forward declaration or
receiver type 'BoxSearchRequestBuilder' for instance message is a forward declaration.
Basically the BoxSearchRequestBuilder class is declared via a forward declaration (#BoxSearchRequestBuilder), so I cannot directly access its properties/initializers.
I can fix the error by going to the iOS SDK class BoxSearchResourceManager and changing the forward declaration to an import statement:
#import "BoxSearchRequestBuilder.h"
//#class BoxSearchRequestBuilder;
However, I don't think I should be doing this. Are there any other alternatives? The rest of the API works fine.
Thanks for flagging this.
It has been fixed thanks to your feedback in this change:
https://github.com/box/box-ios-sdk-v2/commit/67064ea1f0c1aff040fba1e249b9f550281c01e2
feel free to file issues on SDK github page.
I have been working in storyboard designing app for IOS. No code, besides automatically generated one is written. After reopening storyboard file in Xamarin I got following error:
System.AggregateException: One or more errors occured ---> MonoTouch.Design.Client.DesignerRemoteException: System.ArgumentNullException: Argument cannot be null.
Parameter name: key
at System.Collections.Generic.Dictionary`2[MonoTouch.UIKit.UIImage,System.String].set_Item (MonoTouch.UIKit.UIImage key, System.String value) in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:216
at MonoTouch.Design.Server.ImageResourceManager.SetImage (System.String name, MonoTouch.UIKit.UIImage value) in /Users/builder/data/lanes/1089/7d45bbe2/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Design.Server/ImageResourceManager.cs:79
at MonoTouch.Design.Server.SessionController+<PostImageResource>c__AnonStorey3.<>m__0 () in /Users/builder/data/lanes/1089/7d45bbe2/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Design.Server/SessionController.cs:167
at MonoTouch.Design.NativeExtensions+<SafeInvokeOnMainThread>c__AnonStorey0.<>m__0 () in /Users/builder/data/lanes/1089/7d45bbe2/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Design.Server/Util/NativeExtensions.cs:378
at MonoTouch.Design.Client.ServerProcessConnection.SendRequest (MonoTouch.Design.CommandRequest req, Boolean throwIfNotRunning) [0x0007f] in /Users/builder/data/lanes/1089/7d45bbe2/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Design.Client/Connection/ServerProcessConnection.cs:195
at MonoTouch.Design.Client.ServerProcessConnection.SendRequest[Object] (MonoTouch.Design.CommandRequest req, Boolean throwIfNotRunning) [0x00004] in /Users/builder/data/lanes/1089/7d45bbe2/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Design.Client/Connection/ServerProcessConnection.cs:202
at MonoTouch.Design.Client.ServerProcessConnection.PostResources (MonoTouch.Design.DesignSession session, MonoTouch.Design.ImageResource[] resources) [0x0003f] in /Users/builder/data/lanes/1089/7d45bbe2/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Design.Client/Connection/ServerProcessConnection.cs:132
at MonoTouch.Design.Client.IPhoneDesignerSession+<SendImageResources>c__AnonStorey13.<>m__1 () [0x00019] in /Users/builder/data/lanes/1089/7d45bbe2/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Design.Client/IPhoneDesignerSession.cs:1329
at System.Threading.Tasks.TaskActionInvoker+FuncInvoke`1[System.Object].Invoke (System.Threading.Tasks.Task owner, System.Object state, System.Threading.Tasks.Task context) [0x00000] in /Volumes/build-root-ramdisk/mono-3.6.0/mcs/class/corlib/System.Threading.Tasks/TaskActionInvoker.cs:242
at System.Threading.Tasks.Task.InnerInvoke () [0x00031] in /Volumes/build-root-ramdisk/mono-3.6.0/mcs/class/corlib/System.Threading.Tasks/Task.cs:548
at System.Threading.Tasks.Task.ThreadStart () [0x000d0] in /Volumes/build-root-ramdisk/mono-3.6.0/mcs/class/corlib/System.Threading.Tasks/Task.cs:438
Can anybody help to figure out what this means?
As far as I can tell the error is caused by the following:
iOS Designer opens the StoryBoard and tries to parse the XML inside.
Upon parsing it calls MonoTouch.Design.Server (which probably runs code against Xcode for rendering the XML). While doing so it encounters a ViewElement containing a UIImage. So then it tries to setup the UIImage using parameters stored in a Dictionary (filled using the same XML). When it tries to access that Dictionary for the parameters to yield to UIImage it puts in a 'null' for the key and this causes your error.
Now I don't know exactly what in your Storyboard causes this error as you haven't provided the Storyboard-file in question (nor can I guarantee I could find that error if you had), but you can try some of the following things to try and resolve the issue.
Try and open the Storyboard in Xcode instead of iOS Designer. It sometimes manages to fix corrupt Storyboards that iOS Designer can't handle.
Open the Storyboard in XML-view and have a look at the elements that have UIImages in them. Try and see if anyone of them has a 'strange' name, source, value or something.
Post the Storyboard here and see if anyone else can spot the error
I encountered a similar scenario in that the error message started exactly as in the original post. I could not open the storyboard both in Visual Studio 2015 and in Xamarin Studio 5.10.3 (build 51)
After spending some time in comparing the changes to the .csproj file i figured out that the image for ipad caused this issue for me. I do not know the actual reason for the original post but for me, i had an image to be used as the app logo for ipad and i had named it as "imagename#ipad.png". It turns out this freaks out the designer even though XCode 7 perfectly opens the storyboard.
Finally i renamed the image as "imagename~iPad.png" and that did the trick. Both VS 2015 and XS 5.10.3 are happy to open the storyboard!
Documentation from Xamarin below for working with images
https://developer.xamarin.com/guides/ios/application_fundamentals/working_with_images/sizes-and-filenames/