Я хочу присвоить некоторые значения NSMutableArray
в методе обновления местоположения.Я могу сделать это, но я не могу видеть значения этого массива в другом методе делегата.
for (int i=0; i<[ws3.CustomerID count]; i++) {
//radian hesaplaması
float total = [first floatValue];
float theta = total * M_PI/180;
float total2 = [second floatValue];
float theta2 = total2 * M_PI/180;
float total3 = [[ws3.Latitude objectAtIndex: i] floatValue];
float theta3 = total3 * M_PI/180;
float total4 = [[ws3.Longitude objectAtIndex: i] floatValue];
float theta4 = total4 * M_PI/180;
distance = 6371 * acos(cos(theta) * cos(theta3)
* cos(theta4 - theta2)
+ sin(theta) * sin( theta3)) ;
NSLog(@"xxxxx %f",distance);
num = [NSNumber numberWithFloat:distance];
[enyakinarray addObject:num];
NSLog(@"asasasas %@",enyakinarray);
}
Я вижу переменную enyakinarray
с NSLog
, но
-(void)serviceDones
{
NSLog(@"öhö %@",enyakinarray);
for (int i=0; i<[enyakinarray count]; i++) {
for (int j=i+1; j<[enyakinarray count]; j++) {
if ([enyakinarray objectAtIndex:i]<=[enyakinarray objectAtIndex:j]) {
enyakinfirma.text=[ws3.CustomerName objectAtIndex:i];
}
}
}
}
В этой строке NSLog(@"öhö %@",enyakinarray);
Я не вижу переменных enyakinarray
.Как я могу решить эту проблему?
У меня есть класс веб-службы, и в этом классе объявлен метод serviceDones
.Я вызываю класс веб-службы в secondViewControll
s viewDidLoad
следующим образом:
ws3=[[GetData2 alloc]init];
ws3.delegate=self;
[ws3 GetWebservice2:@"9677a4218e5371ce12e4e42258b760c21612905b" ];
Кроме того, вот реализация делегата класса веб-службы в secondViewController.m
:
-(void)serviceDones
{
NSLog(@"öhö %@",enyakinarray);
for (int i=0; i<[enyakinarray count]; i++) {
for (int j=i+1; j<[enyakinarray count]; j++) {
if ([enyakinarray objectAtIndex:i]<=[enyakinarray objectAtIndex:j]) {
enyakinfirma.text=[ws3.CustomerName objectAtIndex:i];
}
}
}
}