साथ ही मेरे सवाल के रूप में निकाल रहा है MKMapViewएनोटेशन लीक कारण बनता है। मुझे पता चला है कि अगर आप एक दृश्य के आधार पर प्रोजेक्ट बनाने, एक जोड़ने UISearchBarऔर MKMapViewदृश्य की निब में, तार ऊपर प्रतिनिधियों (जैसा कि हम वास्तव में लीक को गति प्रदान करने में कुछ भी करने की जरूरत नहीं है मैं किसी भी तरीकों बनाने नहीं कर रहा हूँ), में लिंक MapKit और परियोजना की आग, फिर बस पर क्लिक UISearchBarकारण एक 1k + रिसाव। यह जब तक आप दोनों नहीं होता है UISearchBarऔर MKMapViewएक दृश्य में। मैं जब कोड से दृश्य बनाने में एक ही मुद्दे हैं। मैंने सोचा था कि एक निब अलग ढंग से व्यवहार सकता है, लेकिन ऐसा नहीं है।
है MKMapViewटपकाया, या मैं कुछ गलत कर रहा हूँ।
कोड के साथ इस मुद्दे को दोहराने के लिए नीचे दिए गए कोड की कोशिश - मैं एक नया दृश्य आधारित अनुप्रयोग प्रोजेक्ट बनाया
TestMapViewFromCodeViewController.h
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface TestMapViewFromCodeViewController : UIViewController {
UISearchBar *searchBar;
MKMapView *mapView;
}
@property (nonatomic, retain) MKMapView *mapView;
@property (nonatomic, retain) UISearchBar *searchBar;
@end
TestMapViewFromCodeViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
UISearchBar * tmpSearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0.0,0.0,self.view.frame.size.width,40.0)];
[self.view addSubview:tmpSearchBar];
[self setSearchBar:tmpSearchBar];
[tmpSearchBar release];
MKMapView *tmpMapView=[[MKMapView alloc] initWithFrame:CGRectMake(0.0,0.0,self.view.frame.size.width,self.view.frame.size.height)];
tmpMapView.showsUserLocation=FALSE;
[self.view insertSubview:tmpMapView atIndex:0];
[self setMapView:tmpMapView];
[tmpMapView release];
}
- (void)dealloc {
[mapView release];
[searchBar release];
[super dealloc];
}
हालांकि मैं MapView और Searchbar साथ subviews बरकरार रखा गया है, यह शायद इस मुद्दे को दोहराने के लिए अनावश्यक है।
यहाँ प्रकाशित करने से पहले इस कोड को परीक्षण में मैं सिर्फ देखा है कि इस रिसाव सिम्युलेटर में नहीं होती है - केवल अपने फोन पर ...













