【发布时间】:2011-07-28 07:03:33
【问题描述】:
如何解决这些错误? :(
错误旁边的cmets
谢谢!
AuthenticationViewController.h
#import <UIKit/UIKit.h>
@interface YourViewController : UIViewController {
NSMutableData *dataWebService;
}
AuthenticationViewController.m
#import "AuthenticationViewController.h"
@implementation AuthenticationViewController
//缺少@end
- (void)viewDidLoad
//预期的';'方法原型之后
{
[super viewDidLoad];
NSString *yourPostString = [NSString stringWithFormat:@" write here your SOAP Message or JSON input (depend on your webservice)"];
dataWebService = [[NSMutableData data] retain];
NSMutableURLRequest *request = [[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.yoursite/webService"]] retain];
NSString *postLength = [NSString stringWithFormat:@"%d", [yourPostString length]];
[request addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[request addValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[yourPostString dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *myConnection = [NSURLConnection connectionWithRequest:request delegate:self];
[myConnection start];
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
[dataWebService setLength:0];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[dataWebService appendData:data];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSString *responseString = [[NSString alloc] initWithData:dataWebService encoding:NSUTF8StringEncoding];
NSLog(@"Response: %@",responseString);
[responseString release];
[dataWebService release];
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
NSLog(@"Eror during connection: %@", [error description]);
}
//缺少@end
错误日志
编译C 构建/iPhone.build/Debug-iphonesimulator/iPhone.build/Objects-normal/i386/AuthenticationViewController.o “iPhone Sample/AuthenticationViewController.m”正常 i386 目标-c com.apple.compilers.llvm.clang.1_0.compiler cd /Users/Desktop/ASI/pokeb-asi-http-request-57f7ff2 setenv LANG en_US.US-ASCII setenv PATH “/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin” /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -x 目标-c -arch i386 -fmessage-length=0 -pipe -fdiagnostics-print-source-range-info -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-变量 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -fexceptions -fasm-blocks -mmacosx-version-min=10.6 -gdwarf-2 -fvisibility=hidden -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=30103 -iquote "/Users/Desktop/ASI/pokeb-asi-http-request-57f7ff2/build/iPhone.build/Debug-iphonesimulator/iPhone.build/ASIHTTPRequest iPhone 生成的文件.hmap" “-I/用户/桌面/ASI/pokeb-asi-http-request-57f7ff2/build/iPhone.build/Debug-iphonesimulator/iPhone.build/ASIHTTPRequest iPhone-own-target-headers.hmap" “-I/用户/桌面/ASI/pokeb-asi-http-request-57f7ff2/build/iPhone.build/Debug-iphonesimulator/iPhone.build/ASIHTTPRequest iPhone-all-target-headers.hmap" -iquote "/Users/Desktop/ASI/pokeb-asi-http-request-57f7ff2/build/iPhone.build/Debug-iphonesimulator/iPhone.build/ASIHTTPRequest iPhone-project-headers.hmap" -F/用户/桌面/ASI/pokeb-asi-http-request-57f7ff2/build/Debug-iphonesimulator -I/用户/桌面/ASI/pokeb-asi-http-request-57f7ff2/build/Debug-iphonesimulator/include -I/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/include/libxml2 -I/Users/Desktop/ASI/pokeb-asi-http-request-57f7ff2/build/iPhone.build/Debug-iphonesimulator/iPhone.build/DerivedSources/i386 -I/Users/Desktop/ASI/pokeb-asi-http-request-57f7ff2/build/iPhone.build/Debug-iphonesimulator/iPhone.build/DerivedSources -包括 /var/folders/Cs/CsqSKcbMEOC12Z96tZhqZ++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/iPhone_Prefix-gdcjyckfdobukjghijdsfunokuto/iPhone_Prefix.pch -c "/Users/Desktop/ASI/pokeb-asi-http-request-57f7ff2/iPhone 示例/AuthenticationViewController.m" -o /Users/Desktop/ASI/pokeb-asi-http-request-57f7ff2/build/iPhone.build/Debug-iphonesimulator/iPhone.build/Objects-normal/i386/AuthenticationViewController.o
/Users/Desktop/ASI/pokeb-asi-http-request-57f7ff2/iPhone 示例/AuthenticationViewController.m:3:17:错误:缺少 @end @implementation AuthenticationViewController ^ /用户/桌面/ASI/pokeb-asi-http-request-57f7ff2/iPhone 示例/AuthenticationViewController.m:5:20:错误:预期的“;”后 方法原型 - (void)viewDidLoad ^ ; /用户/桌面/ASI/pokeb-asi-http-request-57f7ff2/iPhone 示例/AuthenticationViewController.m:56:5:错误:缺少 @end @end ^ 生成 3 个错误。
【问题讨论】:
-
针对 stackoverflow 的新手的很好的书面问题。欢迎来到 SO。
标签: iphone web-services asihttprequest