草庐IT

ios - Swift - 专门的 _VariantDictionaryBuffer.ensureUniqueNativeBuffer(Int)

coder 2024-01-28 原文

我是个新手,错误很快。 我的应用遇到特殊错误,有时我无法弄清楚。

任何人都可以建议如何解决这个问题以及通常导致专业错误的原因吗?

这是我得到的错误报告。

 0  libsystem_kernel.dylib         0x183cf12ec __pthread_kill + 8
 1  libsystem_pthread.dylib        0x183e966a8 pthread_kill$VARIANT$armv81 + 360
 2  libsystem_c.dylib              0x183c5fd0c abort + 140
 3  libsystem_malloc.dylib         0x183d29838 szone_size + 634
 4  libswiftCore.dylib             0x104078f10 _swift_release_dealloc + 28
 5  AppMy                             0x1021b45b8 specialized _VariantDictionaryBuffer.ensureUniqueNativeBuffer(Int) -> (reallocated : Bool, capacityChanged : Bool) (WatchListStockViewController.swift)
 6  AppMy                             0x1021b5a14 specialized specialized _VariantDictionaryBuffer.nativeUpdateValue(B, forKey : A) -> B? (WatchListStockViewController.swift)
 7  AppMy                          0x1021b612c specialized WatchListStockViewController.updateCompanies(String, widget : JSON) -> () (WatchListStockViewController.swift:1065)
 8  AppMy                          0x1021b67dc specialized WatchListStockViewController.fireSocketMessage(JSON) -> () (WatchListStockViewController.swift:1039)
 9  AppMy                          0x1021b96d8 partial apply for WatchListStockViewController.(subscribeWebSocket() -> ()).(closure #1) (WatchListStockViewController.swift:200)
 10 AppMy                          0x102538318 JSON (StreamHomeViewController.swift)
 11 AppMy                          0x1022abb70 specialized SockJSManager.handleChannel(JSON) -> () + 4369972080
 12 AppMy                          0x1022a8514 SockJSManager.(handleMessage(response : String) -> ()).(closure #1) (SockJSManager.swift:399)
 13 AppMy                          0x10250c28c _T0Ieg_IeyB_TR (BaseViewController.swift)
 14 libdispatch.dylib              0x183b5cb24 _dispatch_call_block_and_release + 24
 15 libdispatch.dylib              0x183b5cae4 _dispatch_client_callout + 16
 16 libdispatch.dylib              0x183b98528 _dispatch_queue_override_invoke$VARIANT$armv81 + 700
 17 libdispatch.dylib              0x183b9e3a4 _dispatch_root_queue_drain + 592
 18 libdispatch.dylib              0x183b9e0f0 _dispatch_worker_thread3 + 112
 19 libsystem_pthread.dylib        0x183e8ffac _pthread_wqthread + 1176
 20 libsystem_pthread.dylib        0x183e8fb08 start_wqthread + 4

最佳答案

首先,为了帮助调试一般的异常,这个 Xcode Help page描述了如何创建异常断点。了解此处实际抛出的异常类型会很有帮助 - 也许是 EXP_BAD_ACCESS


现在说说你的具体崩溃。

“特化”一词并不能真正说明这里的问题,它仅表示调用的方法签名派生自 generic ones .

此外,要真正了解发生了什么,需要查看 WatchListStockViewController.updateCompanies(String, widget : JSON) 的源代码。

我从您的堆栈跟踪中可以看出,您的应用程序在尝试更新 _VariantDictionaryBuffer 中的值时崩溃,该值用作 Dictionary 的基础数据结构.鉴于 Swift 中的字典不是线程安全的,并且您的代码在调度队列中运行,看似处理(并行?)WebSocket,错误可能是由对某些字典的并发读/写访问引起的包含“公司”信息。能否同时从不同线程调用 WatchListStockViewController.updateCompanies

同样,在不知道代码的情况下很难说出到底出了什么问题,也许您可​​以在您的问题中附上一个片段...

关于ios - Swift - 专门的 _VariantDictionaryBuffer.ensureUniqueNativeBuffer(Int),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50406346/

有关ios - Swift - 专门的 _VariantDictionaryBuffer.ensureUniqueNativeBuffer(Int)的更多相关文章

  1. ruby - 将数组的内容转换为 int - 2

    我需要读入一个包含数字列表的文件。此代码读取文件并将其放入二维数组中。现在我需要获取数组中所有数字的平均值,但我需要将数组的内容更改为int。有什么想法可以将to_i方法放在哪里吗?ClassTerraindefinitializefile_name@input=IO.readlines(file_name)#readinfile@size=@input[0].to_i@land=[@size]x=1whilex 最佳答案 只需将数组映射为整数:@land边注如果你想得到一条线的平均值,你可以这样做:values=@input[x]

  2. ruby - 如何验证 IO.copy_stream 是否成功 - 2

    这里有一个很好的答案解释了如何在Ruby中下载文件而不将其加载到内存中:https://stackoverflow.com/a/29743394/4852737require'open-uri'download=open('http://example.com/image.png')IO.copy_stream(download,'~/image.png')我如何验证下载文件的IO.copy_stream调用是否真的成功——这意味着下载的文件与我打算下载的文件完全相同,而不是下载一半的损坏文件?documentation说IO.copy_stream返回它复制的字节数,但是当我还没有下

  3. Ruby 文件 IO 定界符? - 2

    我正在尝试解析一个文本文件,该文件每行包含可变数量的单词和数字,如下所示:foo4.500bar3.001.33foobar如何读取由空格而不是换行符分隔的文件?有什么方法可以设置File("file.txt").foreach方法以使用空格而不是换行符作为分隔符? 最佳答案 接受的答案将slurp文件,这可能是大文本文件的问题。更好的解决方案是IO.foreach.它是惯用的,将按字符流式传输文件:File.foreach(filename,""){|string|putsstring}包含“thisisanexample”结果的

  4. Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting - 2

    1.错误信息:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:requestcanceledwhilewaitingforconnection(Client.Timeoutexceededwhileawaitingheaders)或者:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:TLShandshaketimeout2.报错原因:docker使用的镜像网址默认为国外,下载容易超时,需要修改成国内镜像地址(首先阿里

  5. ruby - 为什么不能使用类IO的实例方法noecho? - 2

    print"Enteryourpassword:"pass=STDIN.noecho(&:gets)puts"Yourpasswordis#{pass}!"输出:Enteryourpassword:input.rb:2:in`':undefinedmethod`noecho'for#>(NoMethodError) 最佳答案 一开始require'io/console'后来的Ruby1.9.3 关于ruby-为什么不能使用类IO的实例方法noecho?,我们在StackOverflow上

  6. ruby - 在 Ruby 中实现 to_int 和 to_str 的后果 - 2

    我haveaclass它公开了一个字符串值和一个int值(分别是命令输出和退出代码)。除了通过to_s和to_i公开它们之外,我还使用to_str和to_int,如下所示:classStatusdefto_s@outputendalias:to_str:to_sdefto_i@status.exitstatusendalias:to_int:to_iend我的想法是能够在尽可能多的情况下使用这个对象。将其强制转换为字符串或整数会增加可用性。例如,我可以将对象与字符串连接起来:a_string="Outputwas:"+results(我想用这个作为int强制转换的例子,但是Fixnum

  7. ruby-on-rails - ruby rails 将参数转换为 int 数组 - 2

    我正在通过get发送数据,我需要将其放入一个int数组中以便在查找中使用。这是我的代码:@found=Array.newparams['candidate'].eachdo|c|@found我的网址是这样的http://localhost:3000/export/candidate?candidate[]=3&candidate[]=4&commit=Export如果它有任何不同,我将它用于此查找@candidate=Candidate.find(:all,:conditions=>["candidates.idIN?",@found])但目前它并没有把它放在一个真正的数组中,因为我得

  8. ruby - 重构 Ruby : Converting string array to int array - 2

    我正在重构一个西洋跳棋程序,我正在尝试将玩家移动请求(例如以“3、3、5、5”的形式)处理到一个int数组中。我有以下方法,但感觉不像我所知道的那样像Ruby:deftranslate_move_request_to_coordinates(move_request)return_array=[]coords_array=move_request.chomp.split(',')coords_array.each_with_indexdo|i,x|return_array[x]=i.to_iendreturn_arrayend我用它进行了以下RSpec测试。it"translatesa

  9. arrays - 在 Ruby 中将字符串转换为 int 数组 - 2

    如何将字符串:s='23534'转换为这样的数组:a=[2,3,5,3,4]有没有一种方法可以遍历ruby​​中的字符并将它们中的每一个转换为to_i或者甚至像Java一样将字符串表示为char数组,然后转换所有字符to_i如您所见,我在字符串中没有这样的分隔符,,我在SO上找到的所有其他答案都包含一个分隔符。 最佳答案 一个简单的衬里是:s.each_char.map(&:to_i)#=>[2,3,5,3,4]如果您希望在字符串不只包含整数时显示错误,您可以这样做:s.each_char.map{|c|Integer(c)}这会引

  10. ruby - 为 IO::popen 拯救 "command not found" - 2

    当我将IO::popen与不存在的命令一起使用时,我在屏幕上打印了一条错误消息:irb>IO.popen"fakefake"#=>#irb>(irb):1:commandnotfound:fakefake有什么方法可以捕获此错误,以便我可以在脚本中进行检查? 最佳答案 是:升级到ruby​​1.9。如果您在1.9中运行它,则会引发Errno::ENOENT,您将能够拯救它。(编辑)这是在1.8中的一种hackish方式:error=IO.pipe$stderr.reopenerror[1]pipe=IO.popen'qwe'#

随机推荐