【Unity3D游戏开发】System.Collections.Generic.ICollection`1.CopyTo 错误 (二三)

在Unity3D游戏开发过程中遇到iOS平台上System.Collections.Generic.ICollection`1.CopyTo错误。错误源于尝试将 receipts 转换为 List<string> 的操作。为解决问题,可以避免直接使用CopyTo方法,改为使用for循环逐个元素赋值,虽然这种方法较为繁琐。
摘要由CSDN通过智能技术生成

使用Unity,编辑器模式没有问题,iOS上报错误

System.Collections.Generic.ICollection`1.CopyTo


错误位置:

string[] receipts = PlayerPrefsEx.GetStringArray("unfinished_iap_receipt");
List<string> unFinIAPReceipts = new List<string>(receipts);

出错原因:

Most of Linq extension methods from Linq for Collections are not working with IEnumerables on iOS since they require AOT runtime compiler which is not supported.

However there is a Linq for iOS library on Asset Store that is similar to Linq but doesn't require a runtime compiler. So you can use it on iOS and ToArray() method will work with this library.


iOS真机上对使用C#的Linq有限制 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值