Ich bin neu bei IOS Ich möchte Antwort von Beitrag in Alarmansicht anzeigen.in NSLog ich zeigte Antwort. ich brauche, als ich Knopfwarnungsansicht anklickte, kann meine Antwort anzeigen.Antwort in Alarmansicht
Codierung:
-(void) sendDataToServer : (NSString *) method params:(NSString *)str{
NSData *postData = [str dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%lu", (unsigned long)[str length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:URL]];
NSLog(@"%@",str);
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody:postData];
NSURLConnection *theConnection = [NSURLConnection connectionWithRequest:request delegate:self];
if(theConnection){
mutableData = [[NSMutableData alloc]init];
}
}
alerview:
- (IBAction)butt1:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Value"
message:@"%@"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"ok", nil];
[self sendDataToServer :@"POST" params:str];
[alert show];
}
post-Methode Delegierten: hier i Antwort in json111 bekommen, dass ich erfolgreich in NSLog zeigte aber in Alarmansicht gescheitert i
-(void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[mutableData appendData:data];
}
-(void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
return;
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSError* error111;
json111 = [NSJSONSerialization JSONObjectWithData: mutableData
options:kNilOptions
error:&error111];
NSLog(@"%@",json111);
}
[![emptyvalue in alertview][1]][1]
UIAlertView in iOS9 veraltet ist, an diesem Ort Einsatz UIAlertviewController –
ich brauche Antwortwert von post-Methode nicht Textfeld Wert @ Anbu.Karthik –
@ A.sonu oh Eis, nur warte ich meine Anser –