GMSMapView animateToCameraPosition - 发送到实例的无法识别的选择器

时间:2015-07-27 16:28:31

标签: ios google-maps google-maps-sdk-ios

你能否帮我解决这个错误。我使用的是以下版本

  • 适用于iOS的Google Map SDK v1.10.1
  • Xcode v6.4
  • Cocoapods v0.38.2
根据Cocoapods的建议,

和其他链接器标志设置为$(inherited)。 另请注意,我已将委托设置为self和class继承的GMSMapViewDelegate协议。

请告知。

2015-07-28 21:14:11.876 GoogleMapsIssueTest[9719:384475] -[GMSMapView animateToCameraPosition:]: unrecognized selector sent to instance 0x7fd864018d00
2015-07-28 21:14:11.881 GoogleMapsIssueTest[9719:384475] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GMSMapView animateToCameraPosition:]: unrecognized selector sent to instance 0x7fd864018d00'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010b9f4c65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010d59abb7 objc_exception_throw + 45
    2   CoreFoundation                      0x000000010b9fc0ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x000000010b95213c ___forwarding___ + 988
    4   CoreFoundation                      0x000000010b951cd8 _CF_forwarding_prep_0 + 120
    5   GoogleMapsIssueTest                 0x0000000109ce6308 -[GMSMapView setCamera:] + 151
    6   GoogleMapsIssueTest                 0x0000000109ce4c9b -[GMSMapView sharedInitWithServices:camera:forPlaces:] + 2329
    7   GoogleMapsIssueTest                 0x0000000109ce3be6 -[GMSMapView initWithCoder:] + 71
    8   UIKit                               0x000000010c56c24b -[UIClassSwapper initWithCoder:] + 205
    9   UIKit                               0x000000010c6bd956 UINibDecoderDecodeObjectForValue + 705
    10  UIKit                               0x000000010c6bd68c -[UINibDecoder decodeObjectForKey:] + 276
    11  UIKit                               0x000000010c56be44 -[UIRuntimeConnection initWithCoder:] + 153
    12  UIKit                               0x000000010c6bd956 UINibDecoderDecodeObjectForValue + 705
    13  UIKit                               0x000000010c6bdb25 UINibDecoderDecodeObjectForValue + 1168
    14  UIKit                               0x000000010c6bd68c -[UINibDecoder decodeObjectForKey:] + 276
    15  UIKit                               0x000000010c56b2e7 -[UINib instantiateWithOwner:options:] + 990
    16  UIKit                               0x000000010c3c36d8 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
    17  UIKit                               0x000000010c3c3cc8 -[UIViewController loadView] + 109
    18  UIKit                               0x000000010c3c3f39 -[UIViewController loadViewIfRequired] + 75
    19  UIKit                               0x000000010c3c43ce -[UIViewController view] + 27
    20  UIKit                               0x000000010c2df289 -[UIWindow addRootViewControllerViewIfPossible] + 58
    21  UIKit                               0x000000010c2df64f -[UIWindow _setHidden:forced:] + 247
    22  UIKit                               0x000000010c2ebde1 -[UIWindow makeKeyAndVisible] + 42
    23  UIKit                               0x000000010c28f417 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2732
    24  UIKit                               0x000000010c29219e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
    25  UIKit                               0x000000010c291095 -[UIApplication workspaceDidEndTransaction:] + 179
    26  FrontBoardServices                  0x0000000111a215e5 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
    27  CoreFoundation                      0x000000010b92841c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    28  CoreFoundation                      0x000000010b91e165 __CFRunLoopDoBlocks + 341
    29  CoreFoundation                      0x000000010b91df25 __CFRunLoopRun + 2389
    30  CoreFoundation                      0x000000010b91d366 CFRunLoopRunSpecific + 470
    31  UIKit                               0x000000010c290b02 -[UIApplication _run] + 413
    32  UIKit                               0x000000010c2938c0 UIApplicationMain + 1282
    33  GoogleMapsIssueTest                 0x0000000109b557a7 main + 135
    34  libdyld.dylib                       0x000000010dcd0145 start + 1
    35  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

这是代码示例

import UIKit
import GoogleMaps

class ViewController: UIViewController, GMSMapViewDelegate {

    @IBOutlet weak var googleHistoryMapView: GMSMapView!

    var googleHistoryMapCamera: GMSCameraPosition!
    var googleHistoryDrivePath: GMSMutablePath!

    override func viewDidLoad() {
        super.viewDidLoad()

        googleHistoryMapCamera = GMSCameraPosition.cameraWithLatitude(-33.86, longitude: 151.20, zoom: 16)
        googleHistoryMapView.animateToCameraPosition(googleHistoryMapCamera)

        googleHistoryMapView.delegate = self

        googleHistoryMapView.myLocationEnabled = false
        googleHistoryMapView.trafficEnabled = true
        googleHistoryMapView.indoorEnabled = false
    }
}

2 个答案:

答案 0 :(得分:2)

现在通过以下更新修复此问题,Podfile现在可以use_frameworks!

  • 将Cocoapods更新为0.38.2(我想这里的问题已修复)
  • -ObjCOther Linker Flags
  • 中添加了$(inherited)

感谢您的支持

答案 1 :(得分:0)

尝试使用“-ObjC”替换其他链接器标志中的$(继承)。