【问题标题】:Why is XCode giving me an "Incomplete Implementation" warning?为什么 XCode 给我一个“不完整的实现”警告?
【发布时间】:2013-06-16 18:30:28
【问题描述】:

我正在上一门关于 iPhone 应用程序编程的 iTunes U 课程,到目前为止,我一直按照说明进行操作。这是一个简单的纸牌匹配游戏,但 XCode 一直告诉我我没有完全实现我的 Card 类。

卡.h

//
//  Card.h
//  Matchismo
//
//  Created by Jacob Peroutek on 6/14/13.
//  Copyright (c) 2013 JPeroutek. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Card : NSObject

@property (strong, nonatomic) NSString *contents;
@property (nonatomic, getter=faceUp) BOOL faceUp;
@property (nonatomic, getter=isUnplayable) BOOL unplayable;

- (int) match:(NSArray *)otherCards;

@end

这是我的 Card.m 。它旁边显示了一个黄色的小三角警告标志,上面写着“未完成”

卡.m

//
//  Card.m
//  Matchismo
//
//  Created by Jacob Peroutek on 6/14/13.
//  Copyright (c) 2013 JPeroutek. All rights reserved.
//

#import "Card.h"

@implementation Card

- (int)match:(NSArray *)otherCards
{
    int score = 0;
    for (Card *card in otherCards)
    {
        if([card.contents isEqualToString:self.contents])
        {
            score = 1;
        }
    }
    return score;
}

@end

这是我在这个网站上的第一个问题,所以如果我做错了什么,请告诉我。

编辑: 我输入了

@synthesize contents;
@synthesize faceUp;
@synthesize unplayable;

在@implementation 之后进入我的 Card.m,它仍然给我同样的警告。

【问题讨论】:

  • 根据您的 Xcode 版本和目标,您可能需要为您的属性使用 @synthesize
  • 你的 xcode 版本是什么?
  • 我的版本是4.6.3版。
  • 如果您在问题导航器中展开警告(点击 ⌘-4),它将告诉您编译器期望的方法。构建日志中还有更完整的显示——⌘-7 可以看到。
  • Xcode 有时会卡住。尝试删除派生数据。

标签: objective-c xcode warnings implementation


【解决方案1】:

Xcode 有时会卡住。尝试删除派生数据。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-02-05
    • 2013-07-01
    • 2023-03-22
    • 1970-01-01
    • 2015-01-31
    • 1970-01-01
    • 1970-01-01
    • 2011-10-05
    相关资源
    最近更新 更多