安裝的時候我的東西被初始化MKPolyline polylineWithCoordinates崩潰時沒有通過的Xcode
CLLocationCoordinate2D outline[track.lastGeo -track.firstGeo];
CLLocationCoordinate2D upper = ((CLLocation*)track.locations[track.firstGeo]).coordinate;
CLLocationCoordinate2D lower = ((CLLocation*)track.locations[track.firstGeo]).coordinate;
int count = 0;
for (int i = track.firstGeo; i <= track.lastGeo; i++) {
CLLocation *firstLoc = [track.locations objectAtIndex:i];
outline[count++] = firstLoc.coordinate;
if([firstLoc coordinate].latitude > upper.latitude) upper.latitude = [firstLoc coordinate].latitude;
if([firstLoc coordinate].latitude < lower.latitude) lower.latitude = [firstLoc coordinate].latitude;
if([firstLoc coordinate].longitude > upper.longitude) upper.longitude = [firstLoc coordinate].longitude;
if([firstLoc coordinate].longitude < lower.longitude) lower.longitude = [firstLoc coordinate].longitude;
}
_outline = [MKPolyline polylineWithCoordinates:outline count:count -1];
,並通過Xcode的部署後運行良好下面的代碼運行。 但是當我通過iTunes特設安裝應用程序,它與
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x40480b3508f648cf
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 MapKit 0x000000018de19484 -[MKMultiPoint _wrapAroundTheDateline:count:] + 108
1 MapKit 0x000000018de195d8 -[MKMultiPoint _setCoordinates:count:] + 184
2 MapKit 0x000000018de195d8 -[MKMultiPoint _setCoordinates:count:] + 184
3 MapKit 0x000000018de13a74 +[MKPolyline polylineWithCoordinates:count:] + 84
崩潰誰能想到一個原因,那是什麼?
- 的位置不存在作爲一個在Xcode安裝運行良好
- 我沒有改變在Xcode中的任何調試/釋放選項,都是標準的
- 崩潰在不同的設備,但只有當專案
因爲MapKit是不是開源我不知道
[MKMultiPoint _wrapAroundTheDateline:count:]
做或者爲什麼crashe那兒
編輯1
它歸結爲MKMultiPoint試圖malloc的方式太多空間。
malloc: *** mach_vm_map(size=2405744640) failed (error code=3)
XCode的優化級別可能導致這種情況嗎?當運行調試時,它不會發生,所以也許爲了加快速度,釋放代碼被搞砸了,以利用空間來提高速度,從而導致問題出現在這裏?
我正在做的是創建一個約1000個座標(真實生活長度可能是5公里)的折線!
嘗試運行作爲一個發佈版本。這是從Xcode運行和從ad hoc運行之間的巨大差異,所以也許你可以通過從Xcode運行版本構建來獲得相同的區別? – matt
是否這樣做,同樣的行爲,同樣的崩潰。創建MKPolyline時,傳遞給它的所有值都是合法的。 – NikkyD
您是否實際上內存不足?它有助於在循環體上放置一個autorelease池嗎?你有沒有嘗試使用新的地址清潔劑? – matt