简体   繁体   English

iOS 应用程序中的 Google Protobufs 在 GPBDescriptor 处崩溃

[英]Google Protobufs in iOS app crashing at GPBDescriptor

This one is a real head-scratcher...这个真是让人头疼……

PART ONE第一部分

We have a swift iOS application with different targets for Dev and Prod (normal stuff).我们有一个 swift iOS 应用程序,具有不同的开发和生产目标(正常的东西)。

We've incorporated Google Protobufs into it for one of our latest features.我们已将Google Protobufs纳入其中,以实现我们的最新功能之一。 This was done using Google's J2ObjC library and the pod 'Protobuf', '= 3.11.4' pod.这是使用 Google 的 J2ObjC 库和pod 'Protobuf', '= 3.11.4' pod 完成的。 (Our .proto files were made with v3.11.4). (我们的.proto文件是用 v3.11.4 制作的)。

Running our Dev target works fine (mostly, see Part Two).运行我们的 Dev 目标运行良好(主要见第二部分)。 Running our Prod target crashes in the constructor of any GPBMessage object.运行我们的 Prod 目标会在任何 GPBMessage object 的构造函数中崩溃。

It crashes within the + (GPBDescriptor *)descriptor function of the pbobc.m file of our message object...eventually getting to this error within GPBDescriptor.m它在我们的消息 object 的pbobc.m文件的+ (GPBDescriptor *)descriptor function 内崩溃...最终在GPBDescriptor.m中出现此错误

Line:线:

enumHandling_.enumDescriptor_ = coreDesc->dataTypeSpecific.enumDescFunc();

Error:错误:

(lldb) po coreDesc->dataTpeSpecific
error: <user expression 2>:1:11: no member named 'dataTpeSpecific' in 'GPBMessageFieldDescription'
coreDesc->dataTpeSpecific
~~~~~~~~  ^

What's weird is this crashes in Prod and not Dev.奇怪的是这在 Prod 而不是 Dev 中崩溃。 Combing through both targets' Build Settings...they're identical .梳理两个目标的构建设置......它们是相同的。 Build Phases are the same, Build Rules are the same, Plists are basically the same...构建阶段相同,构建规则相同,Plists 基本相同......

I don't know what else to check.我不知道还要检查什么。

PART TWO第二部分

There is one GPB message that crashes on init in both our Dev and Prod targets.在我们的 Dev 和 Prod 目标中,有一条 GPB 消息在初始化时崩溃。 (We can run without it, so I've commented it out during development.) The difference between this message and the others is that this one is a list of enums. (我们可以不使用它,所以我在开发过程中将其注释掉。)这条消息与其他消息的区别在于,这是一个枚举列表。 It crashes on the same line.它在同一条线上崩溃。 ¯\ (ツ) ¯\ (ツ)

Thank you SO MUCH in advance: :D提前非常感谢你:: D

of course immediately after I post the question I find the answer... Google protocol buffers on iOS当然,在我发布问题后立即找到答案...... iOS 上的 Google 协议缓冲区

Needed to add -fno-objc-arc to every ...pbobjc.m file in the Compile Sources of Build Phases .需要将-fno-objc-arc添加到Build PhasesCompile Sources中的每个...pbobjc.m文件中。 I had already done this for a few files in Dev, hence the (very subtle.) difference.我已经为 Dev 中的一些文件完成了此操作,因此存在(非常细微的)差异。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM