2011-06-23 105 views
0

我嘗試使用cloudmade,應用程序崩潰跟蹤兩點之間的路線在我的iPhone應用程序,我得到了這份報告的航線:問題跟蹤兩點

2011-06-23 17:07:56.153 TopStation[1307:9b03] +[NSArray arrayWithContentsOfURL:headers:]: unrecognized selector sent to class 0x2bdb4c4 
2011-06-23 17:07:56.154 TopStation[1307:9b03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSArray arrayWithContentsOfURL:headers:]: unrecognized selector sent to class 0x2bdb4c4' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x02b79919 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x0298e5de objc_exception_throw + 47 
    2 CoreFoundation      0x02b7b4eb +[NSObject(NSObject) doesNotRecognizeSelector:] + 187 
    3 CoreFoundation      0x02aeb116 ___forwarding___ + 966 
    4 CoreFoundation      0x02aeacd2 _CF_forwarding_prep_0 + 50 
    5 TopStation       0x00072bbf -[CMRoutingManager findRouteFrom:] + 580 
    6 Foundation       0x0012f2a8 -[NSThread main] + 81 
    7 Foundation       0x0012f234 __NSThread__main__ + 1387 
    8 libSystem.B.dylib     0x910aa7fd _pthread_start + 345 
    9 libSystem.B.dylib     0x910aa682 thread_start + 34 
) 
terminate called after throwing an instance of 'NSException' 
Program received signal: 「SIGABRT」. 
Data Formatters unavailable (Error calling dlopen for: "/Developer/Applications/Xcode.app/Contents/PlugIns/GDBMIDebugging.xcplugin/Contents/Resources/PBGDBIntrospectionSupport.A.dylib": "dlopen(/Developer/Applications/Xcode.app/Contents/PlugIns/GDBMIDebugging.xcplugin/Contents/Resources/PBGDBIntrospectionSupport.A.dylib, 10): no suitable image found. Did find: 
    /Developer/Applications/Xcode.app/Contents/PlugIns/GDBMIDebugging.xcplugin/Contents/Resources/PBGDBIntrospectionSupport.A.dylib: out of address space") 
(gdb) 

我的代碼如下:

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    [RMMapView class]; 
    TokenManager* tokenManager = [[TokenManager alloc] initWithApikey:@"a53b3323702f42fc8486e24df34f9ac3"]; 
    _routingManager = [[CMRoutingManager alloc] initWithMapView:mapView tokenManager:tokenManager]; 
    _routingManager.delegate = self; 
    CLLocationCoordinate2D from; 
    from.latitude= 53.358311; 
    from.longitude=-6.481934; 
    CLLocationCoordinate2D to; 
    to.latitude=52.657616; 
    to.longitude=-8.635254; 
    CMRoutingVehicle transport = CMVehicleCar;//CMVehicleWalking or CMVehicleBike 
    [_routingManager findRouteFrom:from to:to onVehicle:transport]; 
} 

任何幫助將不勝感激:)

回答

1

此異常

2011-06-23 17:07:56.154 TopStation[1307:9b03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSArray arrayWithContentsOfURL:headers:]: unrecognized selector sent to class 0x2bdb4c4' 

說,你正在發送消息給一個類,它沒有方法,適合它。 +[NSArray arrayWithContentsOfURL:headers:]

我的猜測:你是不是進口的NSArray上一個類別,聲明和實現+arrayWithContentsOfURL:headers:

並確保您添加的鏈接標誌-ObjC -all_load

+0

我不能添加'-ObjC'和' -all_load' 標誌,因爲我使用JSON,並在編譯時產生錯誤。 – Malloc

+0

比你應該調查。 – vikingosegundo

+0

也許這個:http://stackoverflow.com/questions/2906147/what-does-the-all-load-linker-flag-do – vikingosegundo