English 中文(简体)
Xcode press - AddObject
原标题:Xcode warning - addObject

采用以下方法:

-(void) finishQuestionnaire:(id)sender{ 
    NSString * ans;
    NSString* qt = [[[questionArray objectAtIndex:currQNum-1] question] qType];     
    if([qt isEqualToString:@"Slider"]){
        ans = [[[questionArray objectAtIndex:currQNum-1] sliderLabel]text];
    }else if([qt isEqualToString:@"Option"]){               

    }else if([qt isEqualToString:@"TextInput"]){
        ans = [[[questionArray objectAtIndex:currQNum-1] inputAnswer]text];
    }else if([qt isEqualToString:@"ImagePicker"]){

    }else if([qt isEqualToString:@"Comment"]){
        ans = [[[questionArray objectAtIndex:currQNum-1] inputAnswer]text];             
    }
    //UPDATED

NSLog(@"%@", [questionArray objectAtIndex:currQNum-1]);
NSLog(@"%@", [[questionArray objectAtIndex:currQNum-1] question]);
NSLog(@"%@", [[[questionArray objectAtIndex:currQNum-1] question] answer]);

    //[self.navigationController popToRootViewControllerAnimated:YES];
}

qt = 评论 我有以下错误和 app:

 2011-07-20 00:02:04.723 MainMenu[71393:207] -[NSURLCache setAnswer:]: unrecognized selector sent to instance 0x4e29280
    2011-07-20 00:02:04.726 MainMenu[71393:207] *** Terminating app due to uncaught exception  NSInvalidArgumentException , reason:  -[NSURLCache setAnswer:]: unrecognized selector sent to instance 0x4e29280 

我不敢肯定我做了什么错误......。 qt等于斜体和案文......

回答和问答

import <Foundation/Foundation.h>


@interface Answer : NSObject {
    //NSString* answerId;
    NSString* answer;
    NSString* questionId;
    NSString* entryId;
}

//@property (nonatomic, retain) NSString* answerId;
@property (nonatomic, retain) NSString* answer;
@property (nonatomic, retain) NSString* questionId;
@property (nonatomic, retain) NSString* entryId;

@end


#import "Answer.h"


@implementation Answer

@synthesize answer, questionId, entryId;

@end

#import <Foundation/Foundation.h>
#import "Answer.h"

@interface Question : NSObject {
    NSString* qId;
    NSString* qTitle;
    NSString* qNumber;  
    NSString* sectionId;
    NSString* qType;
    Answer* answer;
}

@property (nonatomic, retain) NSString* qId;
@property (nonatomic, retain) NSString* qTitle;
@property (nonatomic, retain) NSString* qNumber;
@property (nonatomic, retain) NSString* sectionId;
@property (nonatomic, retain) NSString* qType;
@property (nonatomic, retain) Answer* answer;

@end


@implementation Question
@synthesize qId, qTitle, qNumber, sectionId, qType, answer;

-(id)init
{
    if (self = [super init])
    {
        // Initialization code here
        answer = [[Answer alloc]init];
    }
    return self;
}

-(void) dealloc{
    [answer release];
    [super dealloc];
}

Edit:见《最新守则》,这里的产出是:

2011-07-20 01:21:04.402 MainMenu[71910:207] <CommentQuestionViewController: 0x4e0b100>
2011-07-20 01:21:04.404 MainMenu[71910:207] <Question: 0x4e55170>
2011-07-20 01:21:04.404 MainMenu[71910:207] (null)

最新情况:

现在我甚至连废。 我的产出只是:

2011-07-20 01:21:04.402 MainMenu[71910:207] <CommentQuestionViewController: 0x4e0b100>
2011-07-20 01:21:04.404 MainMenu[71910:207] <Question: 0x4e55170>
问题回答

Your custom type Answer does not appear to have a method setAnswer.

确保

[[[questionArray objectAtIndex:currQNum-1] question] answer];

回归标的<代码>Answer (看来是<代码>NSURLCache)的类型,然后检查<代码>answer 财产<代码>。

EDIT:在不公布你的全源代码的情况下解决这一问题,从一开始,行走。 为此,我要回答以下几点:

  1. Of what type is [questionArray objectAtIndex:currQNum-1]?
  2. Of what type is [[questionArray objectAtIndex:currQNum-1] question]?
  3. Of what type is [[[questionArray objectAtIndex:currQNum-1] question] answer]?

或许AnswerNSURLCache的子类。 在您的习俗分组负责人和执行档案中,确保你们确定并撰写了一名名为<代码>-setAnswer:的选任人。 要么,要么确保您在Answere>上,而不是在上刊登。

http://www.ohchr.org。

如下:

@implementation Answer

@synthesize answer, questionId, entryId;

@end

应当加以充实。 您是否在<代码>Answer.m上?





相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签