Iphone 是否需要释放MKMapItem或placemark对象?
在我在网上找到的教程(例如)和苹果文档中,没有一个提到发布MKMapItem或placemarks。他们需要被释放吗?如果不需要,为什么不释放?“地图”应用程序能解决所有这些问题吗Iphone 是否需要释放MKMapItem或placemark对象?,iphone,ios6,Iphone,Ios6,在我在网上找到的教程(例如)和苹果文档中,没有一个提到发布MKMapItem或placemarks。他们需要被释放吗?如果不需要,为什么不释放?“地图”应用程序能解决所有这些问题吗 NSDictionary *address = @{ (NSString *)kABPersonAddressStreetKey: _address.text, (NSString *)kABPersonAddressCityKey: _city.text, (NSString *)kABPersonAd
NSDictionary *address = @{
(NSString *)kABPersonAddressStreetKey: _address.text,
(NSString *)kABPersonAddressCityKey: _city.text,
(NSString *)kABPersonAddressStateKey: _state.text,
(NSString *)kABPersonAddressZIPKey: _zip.text
};
MKPlacemark *place = [[MKPlacemark alloc]
initWithCoordinate:_coords
addressDictionary:address];
MKMapItem *mapItem = [[MKMapItem alloc]initWithPlacemark:place];
NSDictionary *options = @{
MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving
};
[mapItem openInMapsWithLaunchOptions:options];
如果您不使用ARC,并且您分配了一个对象,那么您有责任释放它。就这些 在本例中,当您调用openInMaps…,地图项目信息将编码在发送到地图应用程序的URL中。但是你不必为此担心
您可以预期,除非在头文件或文档中调用它,否则实例方法将同步执行其工作,而不会释放接收器 嗨,你有这个项目的样品吗。。