Ios 在Xcode中运行OCUnit测试时EXC\u访问错误
我被这个问题困住了。我有视力测试。我可以在iOS 7模拟器上成功运行它们,但我在iOS 6模拟器上获得了EXC_BAD_访问权限 以下是Xcode的屏幕截图: 我使用的是Ios 在Xcode中运行OCUnit测试时EXC\u访问错误,ios,xcode,ios6,ocunit,ocmockito,Ios,Xcode,Ios6,Ocunit,Ocmockito,我被这个问题困住了。我有视力测试。我可以在iOS 7模拟器上成功运行它们,但我在iOS 6模拟器上获得了EXC_BAD_访问权限 以下是Xcode的屏幕截图: 我使用的是OCMockito和OCHamcrest 你知道是什么原因吗?我正在调查并找出原因 更新: 这里是测试用例的代码(至少来自日志): 来自Xcode的更多图像: 更新: 看起来问题出在从mock调用方法的方法中,其中一个参数是block,它在self上有很强的引用 以下是此方法的代码: - (void)requestDisco
OCMockito
和OCHamcrest
你知道是什么原因吗?我正在调查并找出原因
更新:
这里是测试用例的代码(至少来自日志):
来自Xcode的更多图像:
更新:
看起来问题出在从mock调用方法的方法中,其中一个参数是block,它在self
上有很强的引用
以下是此方法的代码:
- (void)requestDiscoveryWithEmail:(NSString *)email andPassword:(NSString *)password
{
...
// store email / password on view
_email = [email copy];
_password = [password copy];
[self.loginView showSpinner];
[self.network discoveryWithEmail:email
andPassword:password
andCallback:^(NSDictionary *response, NSError *error) {
// Hide the spinner
[self.loginView hideSpinner];
if (error) {
[self showError:error];
}
else {
if (![self isResponseComplete:response]) {
_response = [response copy];
[self.alertManager showAlertMessage:NSLocalizedString(@"We were unable to reach some services because maintenance or some issues", @"Unreachable services message")
withTitle:NSLocalizedString(@"Issues happened", @" Issues happened title")
andDelegate:self];
}
else {
[self processDiscoveryResponse:response];
}
}
}];
}
你能展示一些代码吗?你不能把错误缩小到一个方法吗?你能教我怎么做吗?试着单独运行测试,看看是哪一个导致崩溃!当我试图调用mock实例上的对象时,问题似乎出现了。调查!
- (void)requestDiscoveryWithEmail:(NSString *)email andPassword:(NSString *)password
{
...
// store email / password on view
_email = [email copy];
_password = [password copy];
[self.loginView showSpinner];
[self.network discoveryWithEmail:email
andPassword:password
andCallback:^(NSDictionary *response, NSError *error) {
// Hide the spinner
[self.loginView hideSpinner];
if (error) {
[self showError:error];
}
else {
if (![self isResponseComplete:response]) {
_response = [response copy];
[self.alertManager showAlertMessage:NSLocalizedString(@"We were unable to reach some services because maintenance or some issues", @"Unreachable services message")
withTitle:NSLocalizedString(@"Issues happened", @" Issues happened title")
andDelegate:self];
}
else {
[self processDiscoveryResponse:response];
}
}
}];
}