UICollectionView reloadItemsAtIndexPaths时 报错

在刷新下载进度时 Xcode报错误:

Terminating app due to uncaught exception ‘NSInternalInconsistencyException‘, reason: ‘Invalid update: invalid number of items in section 0.  The number of items contained in an existing section after the update (107) must be equal to the number of items contained in that section before the update (109), plus or minus the number of items inserted or deleted from that section (1 inserted, 1 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out).

in [PhotoViewController fileDownloadingWithProgress:fileName:andType:]

解决方案:

1. 要么更新下载进度的时候,不更新数据源;

2. 要么更新数据源不更新下载进度;在更新数据源前后设置一个能否更新下载的标志,更新下载时检查该标志即可

3. 用reloadData 代替reloadItems,但是开销比较大

时间: 2025-02-01 23:46:17

UICollectionView reloadItemsAtIndexPaths时 报错的相关文章

oc调用c++接口时 报错 Undefined symbols for architecture i386:

当在oc中调用c++中的方法时,发现说c++中的方法没定义或是找不到 Undefined symbols for architecture i386: "_desTYData", referenced from:-[TuYoo encryptParametersWithDict:] in libtuyoo.a(TuYoo.o)ld: symbol(s) not found fo 记得c++中的方法定义是要这样定义的 extern"C" { const char *d

WPF加载Winform窗体时 报错:子控件不能为顶级窗体

一.wpf项目中引用WindowsFormsIntegration和System.Windows.Forms 二.Form1.Designer.cs 的 partial class Form1 设置为:public partial class Form1 三.代码如下: XXXX.Form1 Zhuwindow = new XXXX.Form1(); Zhuwindow.TopLevel = false; Zhuwindow.FormBorderStyle = System.Windows.Fo

Swift 给UITableView 写extension 时 报错 does not conform to protocol 'UITableViewDataSource'

那是因为你没有实现 数据源和代理方法 实现下就好了 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 0 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { return UITableViewCell() } Sw

解决 vs2010 联接sql 2005 时 报错未能加载文件或程序集“Microsoft.SqlServer.Management.Sdk.Sfc

http://blogs.msdn.com/b/sqlnativeclient/archive/2008/05/30/sqlncli-msi-for-sql-server-2008.aspx 关键是这位老兄的回复,第三条 DavidDmsVcp - MSFT 6 Mar 2013 9:13 AM # You can find the sqlncli.msi in a SQL Server feature pack: Microsoft SQL Server 2008 SP3 Feature Pa

全局安装的 webpack运行时 报错 Error: Cannot find module 'webpack' ......

全局安装的webpack   安装指令如下 cnpm install wepack -save-dev -g 但是 在我的项目空间运行webpack指令的时候 会报如下错误 为了方便抓取{ Error: Cannot find module 'webpack' at Function.Module._resolveFilename (module.js:527:15) at Function.Module._load (module.js:476:23) at Module.require (m

VUE.JS 使用axios数据请求时数据绑定时 报错 TypeError: Cannot set property 'xxxx' of undefined 的解决办法

正常情况下在data里面都有做了定义 在函数里面进行赋值 这时候你运行时会发现,数据可以请求到,但是会报错 TypeError: Cannot set property 'listgroup' of undefined 主要原因是: 在 then的内部不能使用Vue的实例化的this, 因为在内部 this 没有被绑定.可以看下 Stackoverflow 的解释: 解决办法: 1.用ES6箭头函数,箭头方法可以和父方法共享变量 2.在请求axios外面定义一下 var that=this 问题

VUE - 使用axios数据请求时数据绑定时 报错 TypeError: Cannot set property 'xxxx' of undefined 的解决办法

created() { var that=this axios.get('http://jsonplaceholder.typicode.com/todos') .then(function (res) { // handle success // console.log(res); that.todos = res.data }) .catch(function (error) { // handle error console.log(error); }) .finally(function

用random.randint函数时 报错 'str' object cannot be interpreted as an integer问题

range()仅将int值用作参数.所以会报错. 原: n=input("輸入") 解决方法: 1.eval() n=eval(input("輸入")) 2.用int() n=int(input("輸入")) 用random.randint函数时 报错 'str' object cannot be interpreted as an integer问题 原文地址:https://www.cnblogs.com/claudia529/p/12078

格式化namenode时 报错 No Route to Host from node1/192.168.1.111 to node3:8485 failed on socket timeout exception: java.net.NoRouteToHostException: No route to host

17/08/03 16:06:05 FATAL namenode.NameNode: Failed to start namenode. org.apache.hadoop.hdfs.qjournal.client.QuorumException: Unable to check if JNs are ready for formatting. 1 successful responses: 192.168.1.114:8485: false 1 exceptions thrown: 192.1