1

My Map application is on iTune market which runs good on iOS 4 and iOS 5. I have developed this application using Xcode 3.2, iPhone sdk 4.2 on Mac mini having Mac OS 10.6.8.

This application .ipa file is crashing after launching on iOS 6. I am developing app on MacMini and I could not able to run xcode 4.5 to rectify the crash. I am pasting some code which runs on launching. If there is some deprecated methods which causes crash then please help because I am not able to check this code without Mac OS 10.7(Lion)..

 - (void)viewDidLoad {
if([appDelegate.markers count] == 0 && [mapView.annotations count] == 0 && UserId.data == 0)
{
[self performSelector:@selector(launchActivity) withObject:nil afterDelay:1.0];
}
}



- (void) launchActivity {
 Reachability *r = [Reachability reachabilityWithHostName:@"www.google.com"];
 NetworkStatus internetStatus = [r currentReachabilityStatus];

if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN))
{
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"No Internet  Connectivity!" message:@"This app require an internet connection via WiFi or cellular  network to work." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
    [myAlert show];
    [myAlert release];
}
else
{
    locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
    locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
    [locationManager startUpdatingLocation];

    if([self.mapView.annotations count] == 1) 
    { 

    } 


    if (locationManager.location == nil)
    {

    }
    else
    {
        // Change map region using span (degrees)...
        MKCoordinateSpan span = MKCoordinateSpanMake(0.001, 0.001);
        MKCoordinateRegion region = MKCoordinateRegionMake
        (locationManager.location.coordinate, span);
        [mapView setRegion:region animated:YES];

    }
    mapView.showsUserLocation = YES;

    BOOL locationAllowed = [CLLocationManager locationServicesEnabled];

    if (locationAllowed==NO)
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location Service Disabled" 
                                                        message:@"To re-enable, please go to Settings and turn on Location Service for this app." 
                                                       delegate:nil 
                                              cancelButtonTitle:@"OK" 
                                              otherButtonTitles:nil];
        [alert show];
        [alert release];
        return;
    }
    else
    {

    [NSThread detachNewThreadSelector:@selector(updateFilterProgress) toTarget:self withObject:nil];   //NSthread not taken because Default.png stay while loading the results


          //==========================================================================================  ==================================
        //Searching Showroom Locations withing the radius

        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        appDelegate = (HettichLocatorAppDelegate *)[[UIApplication sharedApplication] delegate];

        CLLocationCoordinate2D location;


    NSString *url = [[NSString alloc] initWithFormat:@"http://www.company.com.au/directory/phpsqlsearch_genxml.php?lat=%f&lng=%f&radius=5",locationManager.location.coordinate.latitude,locationManager.location.coordinate.longitude];
        radiusinurl.text = @"5km";
        NSURL *URL = [NSURL URLWithString:url];
        NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:URL];
        //Initialize the delegate.
        XMLParser *parser = [[XMLParser alloc] initXMLParser];
        //Set delegate
        [xmlParser setDelegate:parser];
        //Start parsing the XML file.
        BOOL success = [xmlParser parse];


        [parser release];
        [xmlParser release];
        //[URL release];
        [url release];

        if(success)

        {                   
annobjs = [[NSMutableArray array] retain];
            if([appDelegate.markers count] == 0)
            {
                //some logic
            }

            else
            {

for (int i = 0; i < [appDelegate.markers count]; i++)
{

marker *aMarker = [appDelegate.markers objectAtIndex:i];
location.latitude = [aMarker.lat floatValue];
location.longitude =[aMarker.lng floatValue];
AddressAnnotation *annobj = [[AddressAnnotation alloc] initWithCoordinate:location];

    annobj.title = aMarker.name;
annobj.subtitle = aMarker.address;
[annobjs addObject:annobj];
[mapView addAnnotation:annobj];

CLLocationCoordinate2D ausLoc = {location.latitude,location.longitude};         //for zoom in the showroom results region
MKCoordinateSpan ausSpan = MKCoordinateSpanMake(0.108889, 0.169922);
MKCoordinateRegion ausRegion = MKCoordinateRegionMake(ausLoc, ausSpan);
                    mapView.region = ausRegion;
    [annobj release];
    [_tableView reloadData];
    }

   }
 }
else
{
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"" message:@"Unable to  find the results." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
            [myAlert show];
            [myAlert release];
        }
        [pool release]; 
    }

}
}
 }
4

0 回答 0