2010-11-26 4 views
0


私はこの警告を見たことがあり、ソリューションをあまりにも頻繁にしているに違いないと知っています。 。
警告は1つのクラスのみですが、すべて(インポート、実装、ヘッダーファイルなど)が正しく設定されています。私はXcodeでObjective-Cをしばらくコーディングしていますが、自分がiPhoneプログラミングの経験を積んだと言うでしょう。私は完全に、すべてが大丈夫だと確信しています。
XCodeは何とか私がクラスに加えた変更を認識しなかったようです。もはやこのクラスにないいくつかのメソッドを提案しています。私は別のMacでプロジェクトをチェックアウトし、そこにビルドして、すべてうまくいっていて、警告は全くありませんでした。
Xcodeを再インストールして、そこにはいけない迷惑な警告を取り除きたいとは思わない。 XCodeに眼鏡を買わなければならないことを教えてください。 ヘルプは非常に=高く評価され)あなたの通常の「クラス」が「メソッド」の警告に応答しない可能性があります - iPhone/Objective-C

EDIT:さて、ちょうど誰もが言うことができないように、私は狂ったか何かだ、ここのコードと終わりの小さな説明です:

まず
#import <Foundation/Foundation.h> 


@interface URLConnection : NSObject { 
NSString *theURL; 
NSMutableData *receivedData; 
id delegate; // delegate needed for handling response 
} 

@property (nonatomic, retain) NSMutableData *receivedData; 
@property (retain) id delegate; 

- (NSData*) sendSynchronousRequest:(NSData*)_postData; 
- (void) sendRequest:(NSData*)_postData; 

- (void)setDelegate:(id)val; 
- (id)delegate; 

@end 

#import "URLConnection.h" 


@implementation URLConnection 

@synthesize receivedData, delegate; 


- (id) init 
{ 
if (self = [super init]) { 
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
    if (![[defaults stringForKey:@"bankurl"] isEqualToString:@"<Custom URL>"]) { 
     theURL = [[defaults stringForKey:@"bankurl"] retain]; 
    } else { 
     theURL = [[defaults stringForKey:@"bankurl_list"] retain]; 
    } 
    receivedData = [[NSMutableData alloc] init]; 
} 
return self; 
} 

- (void)setDelegate:(id)val 
{ 
    delegate = val; 
} 

- (id)delegate 
{ 
return delegate; 
} 


/* send a synchronous request (specified for xml documents) */ 
- (NSData*) sendSynchronousRequest:(NSData*)_postData 
{ 
NSString *_urlString = theURL; 
NSMutableURLRequest *_urlRequest = [[NSMutableURLRequest alloc] init]; 
[_urlRequest setURL:[NSURL URLWithString:_urlString]]; 
[_urlRequest setHTTPMethod:@"POST"]; 
[_urlRequest setValue:@"text/xml" 
    forHTTPHeaderField:@"Content-Type"]; 
[_urlRequest setHTTPBody:_postData]; 

// response 
NSHTTPURLResponse *_urlResponse = nil; 
NSError *_error = [[NSError alloc] init]; 
NSData *_responseData = [NSURLConnection sendSynchronousRequest:_urlRequest 
               returningResponse:&_urlResponse 
                  error:&_error]; 
[_urlRequest release]; 
NSString *_result = [[NSString alloc] initWithData:_responseData 
              encoding:NSUTF8StringEncoding]; 
NSLog(@"Response code: %d", [_urlResponse statusCode]); 
if ([_urlResponse statusCode] >= 200 && [_urlResponse statusCode] < 300) { 
    NSLog(@"Response: %@", _result); 
} 
return _responseData; 
} 


/* send an asynchronous request (specified for xml documents) */ 
- (void) sendRequest:(NSData*)_postData 
{ 
NSMutableURLRequest *_urlRequest = [[NSMutableURLRequest alloc] init]; 
[_urlRequest setURL:[NSURL URLWithString:theURL]]; 
[_urlRequest setHTTPMethod:@"POST"]; 
[_urlRequest setValue:@"text/xml" 
    forHTTPHeaderField:@"Content-Type"]; 
[_urlRequest setHTTPBody:_postData]; 

[[NSURLConnection alloc] initWithRequest:_urlRequest delegate:self]; 
[_urlRequest release]; 
} 


/* 
    * NSURLRequest Delegate 
    * if a response comes back, clear receivedData to make room for the response data 
    */ 
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response 
{ 
[receivedData setLength:0]; 
} 


/* 
* NSURLRequest Delegate 
* if data is received, append the chunk of data to receivedData 
*/ 
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data 
{ 
[receivedData appendData:data]; 
} 


/* 
* NSURLRequest Delegate 
* when all response data has been stored, call didFinishDownload() in the class 
* which set itself as the delegate 
*/ 
- (void)connectionDidFinishLoading:(NSURLConnection *)connection 

{ 
[delegate didFinishDownload:receivedData]; 

[connection release]; 
//[receivedData release]; 
} 



- (void) dealloc 
{ 
[theURL release]; 
theURL = nil; 
[super dealloc]; 
} 

@end 

はい、私は "[delegate didFinishDownload:receivedData];という行を知っています。警告を出しますが、それは私が書いている問題ではありません。メソッドの提案を見るためにalt + escを押すと、上記のすべてがリストにありますが、ずっと前に削除された "sendRequest:theURL:"と "sendMail:"もあります。

+0

理由はわかりませんが、今日のXCodeの起動後に警告が削除されています。私を打ち負かす...問題解決、私は思う... – zhar

答えて

0

すべてのターゲットをクリーンにしましたか? (これはXcodeのの[ビルド]メニューにあります。)

+0

はい、何度も=) – zhar

+0

@ zhar:プリコンパイルされたヘッダーを含む? – JeremyP

+0

キャッシュを空にすることを意味する場合は、はい、これでも可能です。 – zhar

0

のXcode(アプリケーションメニュー) - >空のキャッシュ...

0

--deleteビルドアプリを保存wherフォルダから、シミュレータから --deleteまたはデバイス。 - すべてのターゲットをクリアします。 - xcodeをクリックしてキャッシュを空にする...

今すぐ警告が表示されません。

+0

私は何度もこの順序ですべてをやったが、何も動作していないようだ。 – zhar

0

あなたのマシンのどこかに、最新のコピーを見つける前にxcodeが見つけている可能性がある別のコピーがないことは間違いありませんか?

+0

はい、私は絶対に確信しています。私はプロジェクトの名前を変更しました。私はそれがSVNリポジトリと関係があると思うが、ソースを見つけることができない= / – zhar

関連する問題