iOS UITextField 弹起键盘崩溃 crash

版权声明:随便转载,方便就写个出处。 https://blog.csdn.net/xiao562994291/article/details/80256282

问题描述

iOS UITextField弹起键盘发生了崩溃,如果设置UITextField的键盘会发现某些键盘类型不会崩溃。程序项目中所有的UITextField和UITextView都是这样。

解决办法:

新建一个项目工程,然后把老项目中的文件都拷贝到新项目中,此过程也就十几分钟,调试一下运行。问题解决了。

问题原因:

未知,可能是多人协同开发项目配置文件被修改或者破坏了。

stackoverflow上找到的解决办法,但没说原因,崩溃日志分析结果如下,对照了一下程序,对应的地方没有发现问题。所有键盘弹出都有问题,感觉是项目配置问题,反正是没找到真正原因,如果有找到原因的大神,欢迎感谢分享。也希望写的这些能帮助一些人解决这个问题。
0 UIKit 0x000000018a8de718 -[UICollectionViewData layoutAttributesForItemAtIndexPath:] + 248
1 UIKit 0x000000018a8de704 -[UICollectionViewData layoutAttributesForItemAtIndexPath:] + 228
2 UIKit 0x000000018aa3586c -[UICollectionView layoutAttributesForItemAtIndexPath:] + 148
3 UIKit 0x000000018b0cd044 -[UIKeyboardCandidateBar _scrollToFirstCandidateInSection:withAnimation:] + 280
4 UIKit 0x000000018b0ccb8c -[UIKeyboardCandidateBar _reloadDataByAppendingAtEnd:initiallyHiddenCandidatesChanged:] + 808
5 UIKit 0x000000018b0ca6a0 -[UIKeyboardCandidateBar setCandidates:inlineText:inlineRect:maxX:layout:] + 1096
6 UIKit 0x000000018a8a7e38 -[UIKeyboardImpl updateTextCandidateView] + 2408
7 UIKit 0x000000018a8a6b30 -[UIKeyboardImpl setCandidates:] + 464
8 UIKit 0x000000018acf0ae4 -[UIKeyboardImpl updateCandidateDisplayAsyncWithCandidateSet:] + 720
9 UIKit 0x000000018ace6b3c -[UIKeyboardImpl inputManagerDidGenerateCandidatesForRequest:resultSet:] + 108
10 UIKit 0x000000018ace6954 __78-[UIKeyboardImpl generateCandidatesAsynchronouslyWithRange:selectedCandidate:]_block_invoke_2 + 68
11 UIKit 0x000000018b540fbc -[UIKeyboardTaskEntry execute:] + 192
12 UIKit 0x000000018a8a66d8 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 384
13 CoreFoundation 0x00000001812cdcd0 __invoking___ + 144
14 CoreFoundation 0x00000001811ac56c -[NSInvocation invoke] + 292
15 UIKit 0x000000018a98cb74 -[_UIActionWhenIdle invoke] + 76
16 CoreFoundation 0x000000018126dedc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
17 CoreFoundation 0x000000018126b894 __CFRunLoopDoObservers + 412
18 CoreFoundation 0x000000018126be50 __CFRunLoopRun + 1292
19 CoreFoundation 0x000000018118be58 CFRunLoopRunSpecific + 436
20 GraphicsServices 0x0000000183038f84 GSEventRunModal + 100
21 UIKit 0x000000018a8e067c UIApplicationMain + 236
22 DouLiao 0x0000000104c40114 0x104bc8000 + 491796
23 libdyld.dylib 0x0000000180ca856c start + 4

stl map 崩溃crash

08-09

我用了stl map,map 这个结构, rn我自己写了个小程序测试没有问题,就是对这个map进行插入,查找,删除. rn但是用在我们的工程里面,就崩溃了.完全一样的代码,也是一样的库支持. rn#include rn#include rn#include rn#include rn#include rnusing namespace std;rnrntypedef struct _MEM_LEAK_INFOrnrn char * file_name;rn size_t line;rn size_t alloc_size;rn size_t alloc_times;rnMEM_LEAK_INFO; rnrntypedef struct _MEM_RECORD_HEADERrnrn size_t alloc_size;rn char* file_name;rn size_t line;rnMEM_RECORD_HEADER;rnrnstd::map map_mem_leak_record;rnrnvoid* operator new(size_t size, char* file_name, size_t line);rnrn#define NEW new(__FILE__, __LINE__)rnrnrnrnrnvoid* operator new(size_t size, char* file_name, size_t line)rnrn MEM_RECORD_HEADER header;rn header.alloc_size = size;rn header.file_name = file_name;rn header.line = line;rnrn MEM_RECORD_HEADER *ptr = (MEM_RECORD_HEADER*)malloc(size+sizeof(MEM_RECORD_HEADER));rn rn ptr->alloc_size = size;rn ptr->file_name = file_name;rn ptr->line = line;rn size_t temp = (size_t)ptr;rn if (ptr)rn rn rn std::map::iterator it = map_mem_leak_record.find(temp); //这个地方挂了,工程里面rn rn if( it != map_mem_leak_record.end() )rn rn it->second.alloc_size += size;rn it->second.alloc_times += 1;rn rn elsern rn MEM_LEAK_INFO mem_info;rn mem_info.file_name = file_name;rn mem_info.line = line;rn mem_info.alloc_size = size;rn mem_info.alloc_times = 1;rn //map_mem_leak_record[temp] = mem_info;rn map_mem_leak_record.insert(pair(temp, mem_info)); rn rn return ptr+1;rn rn elsern rn return NULL;rn rnrnrnrnint _tmain(int argc, _TCHAR* argv[])rnrn rn MEM_RECORD_HEADER* p = NEW(MEM_RECORD_HEADER);rnrnrn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试