Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/121.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 分配枚举属性会覆盖其下的NSArray*属性_Ios_Objective C_Pointers_Enums_Automatic Ref Counting - Fatal编程技术网

Ios 分配枚举属性会覆盖其下的NSArray*属性

Ios 分配枚举属性会覆盖其下的NSArray*属性,ios,objective-c,pointers,enums,automatic-ref-counting,Ios,Objective C,Pointers,Enums,Automatic Ref Counting,我有一个类,其中包括两个属性: @property (nonatomic, assign) UIDeviceOrientation previousOrientation; @property (nonatomic, strong) NSArray* childBrowserUrlWhitelist; 创建阵列时,一切正常: self.childBrowserUrlWhitelist = @[@"myFirstValue", @"mySecondValue"]; 此时,\u childBro

我有一个类,其中包括两个属性:

@property (nonatomic, assign) UIDeviceOrientation previousOrientation;
@property (nonatomic, strong) NSArray* childBrowserUrlWhitelist;
创建阵列时,一切正常:

self.childBrowserUrlWhitelist = @[@"myFirstValue", @"mySecondValue"];
此时,
\u childBrowserUrlWhitelist
指向一个包含预期值的有效地址。 稍后,我分配属性
self.previousOrientation

if (orientation == UIInterfaceOrientationPortrait ||
    orientation == UIInterfaceOrientationPortraitUpsideDown ||
    orientation == UIInterfaceOrientationLandscapeLeft ||
    orientation == UIInterfaceOrientationLandscapeRight)
{
    self.previousOrientation = orientation;
}

在分配了
self.previousOrientation
的点处,
childBrowserUrlWhitelist
的值更改为指向无效位置。据我所知,这可能是由于对
\u previousOrientation
的赋值溢出并破坏了
\u childBrowserUrlWhitelist
中存储的指针造成的,但我不知道为什么会发生这种情况。有人有什么想法吗?

你会使用
@synthesis
语句吗?如果是,请出示。不,我没有使用任何@synthesis语句。嗯,那看起来严重损坏了。您使用的是哪个版本的编译器?编译器设置为“Apple LLVM 5.0”,我使用的是Xcode 5.0.2。我目前的解决方法是将previousOrientation移到一个实例变量而不是一个属性,但我真的很想了解到底发生了什么。这里发生了一些更阴险的事情。我认为您应该向对象实例添加一个监视点,以检查对它的所有写访问。我会想象你有一个stackoverflow或者类似的bug作为根本原因。