【问题标题】:Google Places Autocomplete in iOSiOS 中的 Google 地方信息自动填充功能
【发布时间】:2015-08-05 19:04:06
【问题描述】:

我正在尝试使用这个项目https://github.com/AdamBCo/GooglePlacesAutocomplete 但是当我下载它并输入我的密钥“浏览器应用程序密钥”时,它给了我这个错误(当我开始在搜索字段中输入时)。

2015-05-24 01:37:36.154 GooglePlacesAutocomplete[6780:185340] Length: 1
2015-05-24 01:37:36.806 GooglePlacesAutocomplete[6780:185340] Search: 0
2015-05-24 01:37:36.806 GooglePlacesAutocomplete[6780:185340] AutoComplete URL: https://maps.googleapis.com/maps/api/place/autocomplete/json?input=I&types=establishment|geocode&location=0,0&radius=500&language=en&key=???   (removed my key here)
2015-05-24 01:37:37.100 GooglePlacesAutocomplete[6780:185340] -[__NSCFConstantString objectForKeyedSubscript:]: unrecognized selector sent to instance 0x102f7d410
2015-05-24 01:37:37.112 GooglePlacesAutocomplete[6780:185340] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString objectForKeyedSubscript:]: unrecognized selector sent to instance 0x102f7d410'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000104715a75 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000104f97bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x000000010471cd1d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00000001046749dc ___forwarding___ + 988
    4   CoreFoundation                      0x0000000104674578 _CF_forwarding_prep_0 + 120
    5   GooglePlacesAutocomplete            0x0000000102f78824 -[SearchViewController tableView:cellForRowAtIndexPath:] + 308
    6   UIKit                               0x0000000103384e03 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 508
    7   UIKit                               0x0000000103364901 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2846
    8   UIKit                               0x000000010337a78c -[UITableView layoutSubviews] + 213
    9   UIKit                               0x00000001033071c3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
    10  QuartzCore                          0x0000000103118c58 -[CALayer layoutSublayers] + 150
    11  QuartzCore                          0x000000010310d87e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    12  QuartzCore                          0x000000010310d6ee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
    13  QuartzCore                          0x000000010307b36e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
    14  QuartzCore                          0x000000010307c482 _ZN2CA11Transaction6commitEv + 390
    15  QuartzCore                          0x000000010307caed _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
    16  CoreFoundation                      0x000000010464a507 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    17  CoreFoundation                      0x000000010464a460 __CFRunLoopDoObservers + 368
    18  CoreFoundation                      0x0000000104640293 __CFRunLoopRun + 1123
    19  CoreFoundation                      0x000000010463fbc6 CFRunLoopRunSpecific + 470
    20  GraphicsServices                    0x0000000106dc0a58 GSEventRunModal + 161
    21  UIKit                               0x000000010328d580 UIApplicationMain + 1282
    22  GooglePlacesAutocomplete            0x0000000102f75153 main + 115
    23  libdyld.dylib                       0x00000001068ef145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

我正在使用 Xcode 6 和 iPhone 6 模拟器。 任何帮助将不胜感激。

【问题讨论】:

    标签: ios objective-c autocomplete google-places-api


    【解决方案1】:

    对于我的上一个项目,我编写了一个库来实现您正在尝试的目标。它是在 iOS 应用程序中添加自动完成 Google 地点搜索功能的插入式控件。

    只需 3 个步骤,您就可以集成它。这里是: https://github.com/mrugrajsinh/MVAutocompletePlaceSearchTextField

    【讨论】:

    • 自动完成错误 操作无法完成。 Places API 服务器返回了一个我们无法理解的响应。如果您认为此错误代表错误,请使用我们社区和支持页面 (developers.google.com/places/support) 上的说明提交报告。
    • 我也会遇到与@NileshParmar ,@Mrug 相同的错误
    • 但是兄弟@Mrug的解决方案是什么。如果您对此有所了解,请告诉我。谢谢。
    猜你喜欢
    • 2015-01-20
    • 2020-08-04
    • 2013-12-09
    • 2023-03-12
    • 2016-01-30
    • 2012-04-27
    • 1970-01-01
    • 1970-01-01
    • 2014-03-28
    相关资源
    最近更新 更多