iOS   发布时间:2022-05-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了iphone – OCUnit中无法识别的导入文件大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我正在使用XCode 3.2.3和iOS 4.0上的OCUnit在我的iPhone应用程序上进行单元测试.我已成功设置我的测试环境以适当地传递和失败基本测试,但是当我导入自己的文件时(在这种情况下,“UserAccount.h”,它无法编译并告诉我: “_OBJC_CLASS _ $_ UserAccount”,引自: 然后它说“未找到符号”.这让我感到某种链接器错误,但我不知道发生了什么.我已多
我正在使用XCode 3.2.3和iOS 4.0上的OCUnit在我的iPhone应用程序上进行单元测试.我已成功设置我的测试环境以适当地传递和失败基本测试,但是当我导入自己的文件时(在这种情况下,“UserAccount.h”,它无法编译并告诉我:

“_OBJC_CLASS _ $_ UserAccount”,引自:

然后它说“未找到符号”.这让我感到某种链接错误,但我不知道发生了什么.我已多次建造和清理所有目标,但无济于事.这是我的测试@L_262_4@:

#import "SomeTESTCase.h"
#import "UserAccount.h"

@implementation SomeTESTCase

 - (void)testuserAccount
 {
 // UserAccount.m //

 UserAccount *testAccount = [[UserAccount alloc] initWithUsername:@"" password:@"" deviCEToken:@""];
 [testAccount registerNew];
 NSLog(@"USERID = %@",testAccount.userID);
 STAssertEquals([testAccount login],NO,@"Failure: Login should fail with blank username and password."); // should fail with no username or password

 UserAccount *testAccount2 = [[UserAccount alloc] initWithUsername:@"user" password:@"" deviCEToken:@""]; 
 STAssertEquals([testAccount2 login],@"Failure: Login should fail with blank password.");// should fail with no password

 UserAccount *testAccount3 = [[UserAccount alloc] initWithUsername:@"" password:@"pass" deviCEToken:@""]; 
 STAssertEquals([testAccount3 login],@"Failure: Login should fail with blank username.");// should fail with no password

 }

@end

任何建议将不胜感激.
谢谢!

-Matt

解决方法

我猜想UserAccount.m尚未添加到测试目标中.这将导致“未找到符号”错误.我看到有多个目标的时间,其中Xcode识别标题,即使实现文件不是目标的一部分.

如果这不起作用,请尝试使用Xcode>清空缓存清空Xcode缓存….

大佬总结

以上是大佬教程为你收集整理的iphone – OCUnit中无法识别的导入文件全部内容,希望文章能够帮你解决iphone – OCUnit中无法识别的导入文件所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。