I seem to be having trouble with loading the id
value which is displayed within my iphone application.
When I run the app, it loads the the name, price and a and an image URL. The only section which fails to load depending on its value is the id
. Is anyone able to tell me why this happens just by looking at this code?
[NSString stringWithFormat:@"http://localhost/AM.php?id=%@",self.scannedValue]
When I change %@ to an integer value it shows the image and other info for that id
number, but I'm trying to get that part of the code to take ANY id
number.
localhost/AM.php?id=101
localhost/AM.php?id=102
localhost/AM.php?id=103 <<---- All of the ID's display data about a different item etc..
I set self scannedValue in my scannedViewController.m
, I am basically using the zBar Scanner
to scan a barcode and display the fields I mentioned above.
Can someone please tell me why i have trouble with the code displaying different id's? I already tried the format specifier %@ but it fails to work.
Code from my viewcontroller.m
- (void) readerView:(ZBarReaderView *)readerView didReadSymbols:(ZBarSymbolSet *)symbols fromImage:(UIImage *)image {
for (ZBarSymbol *sym in symbols) {
[reader stop];
[reader removeFromSuperview];
scannedValue = sym.data;
[self performSegueWithIdentifier:@"showDetails" sender:self];
break;
}
}
In this
scannedValue = sym.data;
is string, sum
is ZBarSymbol
class object
In the ZBarSymbol
class
@property (readonly, nonatomic) NSString *data;
is the starting value.
When successfully scanned a value it will return a NSString *data
in delegate method.