我正在尝试让用户从Android上的库中选择图像。但是,当我使用PictureChooser插件时,它似乎不再起作用(不再)
我已经看到了此代码的工作原理,但现在却行不通了,我不知道为什么。
var task = Mvx.Resolve<IMvxPictureChooserTask> ();
task.ChoosePictureFromLibrary (1024, 92,
stream => {
MemoryStream ms = new MemoryStream ();
stream.CopyTo (ms);
_currentTarget.ImageBase64 = Convert.ToBase64String (ms.ToArray ());
SaveTarget ();
RaisePropertyChanged (() => TargetImage);
}, () => {
});
我的日志显示以下内容:
mvx:Warning:1665,79 Warning - activity request code may clash with Mvx code for PickFromFile
mvx:Warning:1665,79 Warning - activity request code may clash with Mvx code for PickFromFile
mvx:Diagnostic:1665,82 OnMvxIntentResultReceived in MvxAndroidTask
mvx:Diagnostic:1665,82 OnMvxIntentResultReceived in MvxAndroidTask
mvx:Diagnostic:1665,83 ProcessMvxIntentResult started...
mvx:Diagnostic:1665,83 ProcessMvxIntentResult started...
mvx:Diagnostic:1665,84 Non-OK result received from MvxIntentResult - Canceled - request was 30001
mvx:Diagnostic:1665,84 Non-OK result received from MvxIntentResult - Canceled - request was 30001
奇怪的是,我确实得到了一个PictureChooser对话框,但同时调用了preventCancelled动作。当我选择图像时,什么也没有发生:(
我正在使用mvvmcross 3.5.1
最佳答案
它发生在某些设备上。不是全部。
原因是我从一个片段(viewmodel)启动picturechooser插件。因此结果处理出错。
我无法立即找到修复程序,因此我首先导航到一个“活动”,然后启动“图片选择器”,目前效果不错。