简体   繁体   English

读取联系人 Xamarin Android(发布版)时,ICursor 为空

[英]ICursor is null when reading contacts Xamarin Android (Release)

Getting contacts from xamarin android is pretty straightforward and I've been using a LoaderManager / CursorLoader to implement it rather that the Xamarin.Contacts Addressbook which is slow for 100+ contacts or more.从 xamarin android 获取联系人非常简单,我一直在使用LoaderManager / CursorLoader来实现它,而不是Xamarin.Contacts Addressbook ,它对于 100 多个联系人或更多联系人来说很慢。

So my question is that on the DEBUG build all contacts will just returns fine but when I build it to RELEASE and casting the data to ICursor it will just returns null .所以我的问题是,在DEBUG构建中,所有联系人都会返回正常,但是当我将其构建为RELEASE并将dataICursor它只会返回null

在此处输入图片说明

So I logged the possible causes and turns out it does not have the ICursor interface implementation when RELEASED .所以我记录了可能的原因,结果发现它在RELEASED时没有ICursor接口实现。

在此处输入图片说明

Any info would be helpful.任何信息都会有帮助。 Thanks.谢谢。

不是将ICursor cursor = data as ICursor而是必须将其转换为ICursor cursor = data.JavaCast<ICursor>();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM