ios - Xcode 测试未检测到我的类(class)

标签 ios iphone xcode swift xcode7

我的项目中有一个名为 Meal.swift 的类和一个单元测试

func testMealInitialization() {
    // Success case.
    let potentialItem = Meal(name: "Newest meal", photo: nil, rating: 5)
    XCTAssertNotNil(potentialItem)

    // Failure cases.
    let noName = Meal(name: "", photo: nil, rating: 0)
    XCTAssertNil(noName, "Empty name is invalid")

}

但问题在于:使用未解析的标识符“Meal”

最佳答案

@testable import MyApp 应该可以正常工作。请记住在 Debug 中为您的 UITest 目标设置适当的配置。

enter image description here

关于ios - Xcode 测试未检测到我的类(class),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31335486/

相关文章:

ios - 如何从工具栏xcode ios中的barbutton中的UICollectionField中获取(索引)文本字段

iphone - 执行选择器 :withObject:afterDelay: not working from scrollViewDidZoom

带有方角的 iphone uibutton

ios - 约束 - 设计、预览和模拟器/设备之间不一致

ios - 如何设置Parse登录查询的超时时间?

iphone - UITableView 的 reloadRowsAtIndexPaths : (NSArray *) indexPaths failing to cause a reload unless you call it twice?

ios - UISwipeGestureRecognizer 只有一个方向工作

objective-c - 让 App Delegate 执行某个操作?

ios - 无法在descriptionForLayoutAttribute_layoutItem_coefficient中创建描述。没什么iOS8

iPhone 静态库模拟器问题