NSMutableArray无限循环

时间:2014-02-26 15:46:26

标签: objective-c nsmutablearray infinite-loop

我正在使用xcode5.0而不是ARC。

这是代码(.h):

@interface MatchmakingServer : NSObject{}

@property (nonatomic, assign) NSMutableArray *connectedClients;

- (void)doSomething;
@end

.mm文件:

#import "MatchmakingServer.h"

@implementation MatchmakingServer

@synthesize connectedClients;

- (id)init
{
    if ((self = [super init]))
    {
    }
    return self;
}
- (void)doSomething 
{
    self.connectedClients = [NSMutableArray arrayWithCapacity:3];
    NSLog(@"%d", self.connectedClients.count);
}
@end

当代码点击NSLog(@"%d", self.connectedClients.count);时,它进入无限循环

我试图在NSLog之前添加一个断点,我看到了:

connectedClients    __NSArrayM *    @"0 objects"    0x0be9c440

在调试器中。

更多信息:我正在混合oc和cpp我不知道是不是这就是导致问题的原因。

任何建议都将不胜感激,谢谢:)

0 个答案:

没有答案
相关问题