NSDictionary-NilSafe icon indicating copy to clipboard operation
NSDictionary-NilSafe copied to clipboard

TableViewCell add system delete side slide

Open BlueSkyInwind opened this issue 6 years ago • 5 comments

In the project using an NSDictionary - NilSafe, the use of a cell in a development side, a sliding a few times, not sideslip phenomenon, after inspection, found that this class, remove side is good, add, just out of the question, don't know if you have ever encountered this situation?

在项目中使用了 NSDictionary-NilSafe 时,在一次开发中使用cell侧滑,出现滑动几次后,不能侧滑的现象,经过检查,发现删除这个类时 ,侧滑是好的,添加上时,就出了问题,不知道你们有没有遇到这情况?

BlueSkyInwind avatar Jun 29 '18 02:06 BlueSkyInwind

你可以试试在 NilSafe 的方法里下断点,特别是检查到 nil 的分支,然后在侧滑前打开断点,看侧滑是是否会进入该分支。

allenhsu avatar Jun 29 '18 06:06 allenhsu

你可以试试在 NilSafe 的方法里下断点,特别是检查到 nil 的分支,然后在侧滑前打开断点,看侧滑是是否会进入该分支。

作者你好,我也遇到了这个问题,经过调试,发现是此分类导致的,请问怎么解决呢?

MenThu avatar Sep 12 '18 03:09 MenThu

  • (void)gl_setObject:(id)obj forKeyedSubscript:(id<NSCopying>)key { if (!key || !obj) { return; } [self gl_setObject:obj forKeyedSubscript:key]; }

这个函数实现的问题,应该修改为:

  • (void)gl_setObject:(id)obj forKeyedSubscript:(id<NSCopying>)key { if (!key) { return; } [self gl_setObject:obj forKeyedSubscript:key]; }

9drops avatar Oct 26 '18 10:10 9drops

发生tableviewcell侧滑闪退可用下面方法进行解决:

  • (void)gl_setObject:(id)obj forKeyedSubscript:(id<NSCopying>)key { if (!key) { return; } if (!obj) { id objKey = key; Class PHMoment = NSClassFromString(@"PHMoment"); if (![objKey isKindOfClass:PHMoment] && ![objKey isKindOfClass:[NSIndexPath class]]) { obj = [NSNull null]; } } [self gl_setObject:obj forKeyedSubscript:key]; }

justinAce avatar Sep 17 '19 12:09 justinAce

In the project using an NSDictionary - NilSafe, the use of a cell in a development side, a sliding a few times, not sideslip phenomenon, after inspection, found that this class, remove side is good, add, just out of the question, don't know if you have ever encountered this situation?

在项目中使用了 NSDictionary-NilSafe 时,在一次开发中使用cell侧滑,出现滑动几次后,不能侧滑的现象,经过检查,发现删除这个类时 ,侧滑是好的,添加上时,就出了问题,不知道你们有没有遇到这情况?


发生tableviewcell侧滑闪退可用下面方法进行解决:

(void)gl_setObject:(id)obj forKeyedSubscript:(id)key { if (!key) { return; } if (!obj) { id objKey = key; Class PHMoment = NSClassFromString(@"PHMoment"); if (![objKey isKindOfClass:PHMoment] && ![objKey isKindOfClass:[NSIndexPath class]]) { obj = [NSNull null]; } } [self gl_setObject:obj forKeyedSubscript:key]; }

justinAce avatar Sep 17 '19 12:09 justinAce