C++ CtlineGetStringIndexFormosition因错误的分配而崩溃

C++ CtlineGetStringIndexFormosition因错误的分配而崩溃,c++,ios,objective-c,core-text,core-foundation,C++,Ios,Objective C,Core Text,Core Foundation,我试图获得文本在一行中的位置,如下所示: CFIndex Idx = CTLineGetStringIndexForPosition(line, pos); 但我得到以下堆栈跟踪崩溃。为什么会发生撞车 - libc++.1.dylib std::__throw_bad_alloc() - CoreText std::__1::__split_buffer<TLine::CaretInfo, std::__1::allocator<TLine::CaretInfo>&&

我试图获得文本在一行中的位置,如下所示:

CFIndex Idx = CTLineGetStringIndexForPosition(line, pos);
但我得到以下堆栈跟踪崩溃。为什么会发生撞车

- libc++.1.dylib std::__throw_bad_alloc()
- CoreText std::__1::__split_buffer<TLine::CaretInfo, std::__1::allocator<TLine::CaretInfo>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<TLine::CaretInfo>&)
- CoreText void std::__1::vector<TLine::CaretInfo, std::__1::allocator<TLine::CaretInfo> >::__emplace_back_slow_path<TLine::CaretInfo>(TLine::CaretInfo&&)
- CoreText TLine::EnumerateCaretOffsets(std::__1::function<void (double, long, bool, bool*)>) const
- CoreText TLine::PositionToCharIndex(CGPoint) const
- CTLineGetStringIndexForPosition(line, pos);
-libc++.1.dylib std::\uuu throw\ubad\ualloc()
-CoreText std::\uuuu1::\uuuu split\u buffer::\uuuu split\u buffer(无符号长,无符号长,std::\uuu1::分配器&)
-CoreText void std::_uu1::vector::_uu安放u后退u缓慢u路径(TLine::CaretInfo&)
-CoreText TLine::EnumerateCareTofSets(标准::_1::函数)常量
-CoreText TLine::PositionToCharIndex(CGPoint)常量
-CtlineGetStringIndexFormosition(行,位置);

在调用
CtlineGetStringIndexFormation
之前,您是否可以包含更多的代码?抱歉,我不能。我无法在本地重新编程崩溃,我唯一拥有的是带有堆栈跟踪的崩溃报告。在调用
CtlineGetStringIndexFormation
之前,您是否可以包含更多代码?抱歉,我不能。我无法在本地重新编程崩溃,我唯一拥有的就是带有堆栈跟踪的崩溃报告。