1
votes

how can I fix these errors? :(
comments beside the errors

thanks!

AuthenticationViewController.h

#import <UIKit/UIKit.h>

@interface YourViewController : UIViewController {
    NSMutableData *dataWebService;
}

AuthenticationViewController.m

#import "AuthenticationViewController.h"

@implementation AuthenticationViewController 

//Missing @end

- (void)viewDidLoad 

//expected ';' after method prototype

{
    [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]);

} 

//Missing @end

error log

CompileC build/iPhone.build/Debug-iphonesimulator/iPhone.build/Objects-normal/i386/AuthenticationViewController.o "iPhone Sample/AuthenticationViewController.m" normal i386 objective-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 objective-c -arch i386 -fmessage-length=0 -pipe -fdiagnostics-print-source-range-info -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -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-generated-files.hmap" "-I/Users/Desktop/ASI/pokeb-asi-http-request-57f7ff2/build/iPhone.build/Debug-iphonesimulator/iPhone.build/ASIHTTPRequest iPhone-own-target-headers.hmap" "-I/Users/Desktop/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/Users/Desktop/ASI/pokeb-asi-http-request-57f7ff2/build/Debug-iphonesimulator -I/Users/Desktop/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 -include /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 Sample/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 Sample/AuthenticationViewController.m:3:17: error: missing @end @implementation AuthenticationViewController ^ /Users/Desktop/ASI/pokeb-asi-http-request-57f7ff2/iPhone Sample/AuthenticationViewController.m:5:20: error: expected ';' after method prototype - (void)viewDidLoad ^ ; /Users/Desktop/ASI/pokeb-asi-http-request-57f7ff2/iPhone Sample/AuthenticationViewController.m:56:5: error: missing @end @end ^ 3 errors generated.

1
Nicely written question for a newbie on stackoverflow. Welcome to SO.Praveen S

1 Answers

1
votes

Implementation of a class is done within the blocks

@implementation classname

@end

You have forgotten to add @end at the end in your .m file.

Its same for the @interface declarations too.