简体   繁体   English

应用扩展:多个实例相互干扰

[英]App Extension: multiple instances interfering with each other

I'm building an iOS App Extension (an Audio Unit plugin in this case). 我正在构建一个iOS App Extension(在这种情况下是一个Audio Unit插件)。 The code is a mix of Objective-C, C++ and C files. 代码是Objective-C,C ++和C文件的混合。

When I run one instance of my Audio Unit in a host it works fine, but once I open another one the two instances start to interfere with each other. 当我在主机中运行我的音频单元的一个实例时它工作正常,但是一旦我打开另一个实例,这两个实例开始互相干扰。 It seems that both instances are unexpectedly sharing some variables between them and I suspect it's happening somewhere in the C libraries I'm using. 似乎两个实例都意外地在它们之间共享一些变量,我怀疑它正在我正在使用的C库中的某个地方发生。

I'm using lots of 'static' declared variables in my .m files to ensure they have file-scope. 我在我的.m文件中使用了很多'静态'声明变量来确保它们具有文件范围。 Am I right in assuming that each instance of the Extension will also have its own instance of each static variable, even when they are declared in a C library? 我是否正确假设Extension的每个实例也将拥有自己的每个静态变量的实例,即使它们是在C库中声明的? Or is using C a bad architectural choice in this case? 或者在这种情况下使用C是一个糟糕的架构选择?

是的,实际上相同音频单元扩展的多个实例共享相同的过程,这是非常令人惊讶的,并且没有记录在任何地方(好像有关音频单元的任何记录!)。

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

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