ios - 重新路由期间Skobbler API的问题

标签 ios objective-c multithreading skmaps

我正在为我的iOS应用程序使用skobbler API。一旦我给出了路线图的起点和终点,它就可以正常工作并且导航也可以按预期工作。在导航期间,我遇到了一个非常随机和奇怪的问题,我的应用程序陷入了内部线程中,并且没有响应。

在导航期间,应用程序仅会因某些路线而崩溃并陷入线程中

线程4:EXC_BAD_ACCESS(代码= 2,地址= 0x0)

0 Router::RouteToTrack(CRoute *,SSegmentForRoutingMatching const&,int,int,bool,bool,int&)

1路由器:: CreateImposedRouteImpl(std::tr1::shared_ptr&,bool,bool)

2 Router::CreateImposedRouteImpl(std::tr1::shared_ptr&,bool,bool)

3 RouteManager::computeRouteFromTrack(SRouteManagerInput&,std::tr1::shared_ptr&,std::vector,std::allocator>>&)

4 RouteManager::run()

5 RouteManager::run()

6 _pthread_start

以下是我用于导航的位置坐标
来源:41.847819,-87.666715
目的地:41.860881,-87.693194

这种情况仅在某些点发生,对于其他位置,导航是完美的!

请提出一些建议,我很久以来一直在寻找解决方案。

这是获取和绘制路线的代码。

          for (SKGPSFileElement *s in routingArray) {
                            if(s.type == SKGPSFileElementGPXTrack)
                            {
                                index++;
                                if(self.trackArray != nil && self.isRouteCalculated == YES)
                                {
                                    __block BOOL sameArray = NO;
                                    for (CLLocation *l in [[SKGPSFilesService sharedInstance] locationsForElement:s]) {
                                        sameArray = NO;
                                        [self.trackArray enumerateObjectsUsingBlock:^(CLLocation *obj, NSUInteger index, BOOL *stop){
                                            if(l.coordinate.latitude == obj.coordinate.latitude && l.coordinate.longitude == obj.coordinate.longitude)
                                            {
                                                *stop = YES;
                                                sameArray = YES;

                                            }
                                        } ];

                                        if(sameArray == NO)
                                            break;
                                    }

                                    if(sameArray == NO)
                                    {
                                         @synchronized([SKRoutingService sharedInstance]){
                                            SKRouteSettings* route = [[SKRouteSettings alloc]init];
                                            route.shouldBeRendered = YES; // If NO, the route will not be rendered.
                                            route.requestAdvices = YES;
                                            route.numberOfRoutes = 1;
                                            [[SKRoutingService sharedInstance]calculateRouteWithSettings:route GPSFileElement:s];
                                        } 
                                    }

                                 }

最佳答案

这就是斯科布勒所说的。不能说我认为这是一个有效的答案...

All UI-related operations (including rendering) must be done on Main thread, so there's nothing we can do about this. Talking into consideration the provided details we cannot suggest any workarounds. If the timers are needed at app startup, maybe you can initialize the framework later, but that depends on your internal logic.



http://forum.skobbler.com/archive/index.php/t-7428.html

关于ios - 重新路由期间Skobbler API的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25866885/

相关文章:

ios - 在ios应用程序中添加Analytics工具

windows - 使用 FileSystemWatcher 在 Windows 服务中一次处理多个文件时出现问题

ios - 带相机的UIImageOrientation

ios - 执行 subview 子类的动画

objective-c - 在 UML 类图上表示 Objective C 协议(protocol)

ios - 图像在 ios 7.1 中不拉伸(stretch)但在 7.0 和 8.0 中完美运行

wpf - 使用 WPF 图像进行线程处理 (System.InvalidOperationException)

java - 使用多个连接下载文件

ios - 不存在 CFBundleIdentifier 为 'xxxxxx' 的软件。

ios - 使用CCMenuItemImage在hud层中创建单个按钮