Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ios): add new search completion APIs #638

Merged
merged 5 commits into from
Sep 23, 2023

Conversation

hansemannn
Copy link
Contributor

@hansemannn hansemannn commented Sep 22, 2023

See the new api docs for details!

Full example:

import Map from 'ti.map';

const window = Ti.UI.createWindow();

const mapView = Map.createView({
  mapType: Map.NORMAL_TYPE
});

window.add(mapView);

Map.addEventListener('didUpdateResults', event => {
  console.warn('Found place:');
  console.warn(event)
});
setTimeout(function() {
  Map.search('Colosseum', {
    // Optional: Define search region
    region: {
      latitude: 41.890560,
      longitude: 12.494270,
      latitudeDelta: 1,
      longitudeDelta: 1,
    },
    // Optional: Define result types (POIs and/or address)
    resultTypes: [Map.SEARCH_RESULT_TYPE_POINT_OF_INTEREST, Map.SEARCH_RESULT_TYPE_ADDRESS]
  });
}, 2000)
window.open();

Download: ti.map-iphone-7.3.0.zip

@m1ga
Copy link
Contributor

m1ga commented Sep 23, 2023

import Map from 'ti.map';

const window = Ti.UI.createWindow();

const mapView = Map.createView({
  mapType: Map.NORMAL_TYPE
});

window.add(mapView);

Map.addEventListener('didUpdateResults', event => {
  console.warn('Found place:');
  console.warn(event)
});
setTimeout(function() {
  Map.search('Colloseum Rome');
}, 2000)
window.open();

returns

[ERROR] �� �Error: *** -[__NSArrayM objectAtIndexedSubscript:]: index 1 beyond bounds [0 .. 0]
[ERROR] �� � at ([native code])
[ERROR] �� � at ()
[ERROR] �� �
[ERROR] �� � CoreFoundation 0x00007ff80045478b __exceptionPreprocess + 242
[ERROR] �� � libobjc.A.dylib 0x00007ff80004db73 objc_exception_throw + 48
[ERROR] �� � CoreFoundation 0x00007ff8004dc806 _CFThrowFormattedException + 200
[ERROR] �� � CoreFoundation 0x00007ff80033ea35 -[_NSArrayM removeAllObjects] + 0
[ERROR] �� � test_ios 0x000000010c02a23f -[TiMapModule search:] + 119
[ERROR] �� � CoreFoundation 0x00007ff80045b09c invoking
+ 140
[ERROR] �� � CoreFoundation 0x00007ff800458406 -[NSInvocation invoke] + 305
[ERROR] �� � TitaniumKit 0x000000010fbdb6e6 -[KrollMethod call:] + 1044
[ERROR] �� � TitaniumKit 0x000000010fbdaaac __KrollCallAsFunction_block_invoke + 30
[ERROR] �� � TitaniumKit 0x000000010fbda8d2 KrollCallAsFunction + 398
[ERROR] �� � JavaScriptCore 0x00000001114e95ef _ZN3JSCL34callJSNonFinalObjectCallbackObjectEPNS_14JSGlobalObjectEPNS_9CallFrameE + 607
[ERROR] �� � JavaScriptCore 0x0000000111e12fc4 _ZN3JSC14handleHostCallEPNS_14JSGlobalObjectEPNS_9CallFrameENS_7JSValueEPNS_12CallLinkInfoE + 980
[ERROR] �� � JavaScriptCore 0x0000000111db442a operationLinkCall + 138
[ERROR] �� � ??? 0x0000584344e07c24 0x0 + 97045941615652
[ERROR] �� � JavaScriptCore 0x00000001114436bb llint_entry + 119561
[ERROR] �� � JavaScriptCore 0x00000001114261a4 vmEntryToJavaScript + 213
[ERROR] �� � JavaScriptCore 0x0000000111cd794c _ZN3JSC11Interpreter11executeCallEPNS_14JSGlobalObjectEPNS_8JSObjectERKNS_8CallDataENS_7JSValueERKNS_7ArgListE + 492
[ERROR] �� � JavaScriptCore 0x00000001114fc039 JSObjectCallAsFunction + 713
[ERROR] �� � JavaScriptCore 0x000000011146f941 -[JSValue callWithArguments:] + 625
[ERROR] �� � TitaniumKit 0x000000010fb8f3c0 -[KrollTimerTarget timerFired:] + 66

@hansemannn
Copy link
Contributor Author

hansemannn commented Sep 23, 2023

@m1ga Did you test with the latest version from today? There was an issue with the options being required (e.g. search('Colloseum', {}) which should have been addressed. The same code logs the following for me:

[WARN]  Found place:
[WARN]  {
[WARN]    results: [
[WARN]      {
[WARN]        title: 'Colloseum',
[WARN]        titleHighlightRanges: [Array],
[WARN]        subtitle: 'Römer',
[WARN]        subtitleHighlightRanges: [Array]
[WARN]      },
[WARN]      {
[WARN]        title: 'Colosseum',
[WARN]        titleHighlightRanges: [],
[WARN]        subtitle: 'Piazza del Colosseo 1, 00184 Rome, Italy',
[WARN]        subtitleHighlightRanges: []
[WARN]      },
[WARN]      {
[WARN]        title: 'Colloseum Loft',
[WARN]        titleHighlightRanges: [Array],
[WARN]        subtitle: 'Via Labicana 80, 00184 Rome, Italy',
[WARN]        subtitleHighlightRanges: []
[WARN]      },
[WARN]      {
[WARN]        title: 'Cavour Colloseum suite',
[WARN]        titleHighlightRanges: [Array],
[WARN]        subtitle: 'Via Cavour 103, 00184 Rome, Italy',
[WARN]        subtitleHighlightRanges: []
[WARN]      },
[WARN]      {
[WARN]        title: 'London Coliseum',
[WARN]        titleHighlightRanges: [],
[WARN]        subtitle: "St Martin's Lane, London, WC2N 4ES, England",
[WARN]        subtitleHighlightRanges: []
[WARN]      },
[WARN]      {
[WARN]        title: 'Drinking Fountain',
[WARN]        titleHighlightRanges: [],
[WARN]        subtitle: 'Colosseum, Piazza del Colosseo 21, 00184 Rome, Italy',
[WARN]        subtitleHighlightRanges: []
[WARN]      },
[WARN]      {
[WARN]        title: 'Los Angeles Memorial Coliseum',
[WARN]        titleHighlightRanges: [],
[WARN]        subtitle: '3911 S Figueroa St, Los Angeles, CA 90037, United States',
[WARN]        subtitleHighlightRanges: []
[WARN]      },
[WARN]      {
[WARN]        title: 'Knoxville Civic Auditorium and Coliseum',
[WARN]        titleHighlightRanges: [],
[WARN]        subtitle: '500 Howard Baker Jr Ave, Knoxville, TN  37915, United States',
[WARN]        subtitleHighlightRanges: []
[WARN]      },
[WARN]      {
[WARN]        title: 'Greensboro Coliseum Complex',
[WARN]        titleHighlightRanges: [],
[WARN]        subtitle: '1921 W Gate City Blvd, Greensboro, NC  27403, United States',
[WARN]        subtitleHighlightRanges: []
[WARN]      },
[WARN]      {
[WARN]        title: '3D Rewind Rome Colloseum',
[WARN]        titleHighlightRanges: [Array],
[WARN]        subtitle: "Via Capo d'Africa 5, 00184 Rome, Italy",
[WARN]        subtitleHighlightRanges: []
[WARN]      },
[WARN]      {
[WARN]        title: 'Colosseum romantic loft',
[WARN]        titleHighlightRanges: [],
[WARN]        subtitle: "Via Capo d'Africa 20A, 00184 Rome, Italy",
[WARN]        subtitleHighlightRanges: []
[WARN]      },
[WARN]      {
[WARN]        title: 'Colosseum Palace Star',
[WARN]        titleHighlightRanges: [],
[WARN]        subtitle: 'Via del Monte Oppio 5, 00184 Rome, Italy',
[WARN]        subtitleHighlightRanges: []
[WARN]      },
[WARN]      {
[WARN]        title: 'Colosseum Suite',
[WARN]        titleHighlightRanges: [],
[WARN]        subtitle: 'Via Cavour 131, 00184 Rome, Italy',
[WARN]        subtitleHighlightRanges: []
[WARN]      },
[WARN]      {
[WARN]        title: 'Coliseum Alfonso Pérez',
[WARN]        titleHighlightRanges: [],
[WARN]        subtitle: 'Avenida de Teresa de Calcuta, 62–84, 28903 Getafe, Madrid, Spain',
[WARN]        subtitleHighlightRanges: []
[WARN]      },
[WARN]      {
[WARN]        title: 'Coliseum',
[WARN]        titleHighlightRanges: [],
[WARN]        subtitle: '20 Rue Caumartin, 80000 Amiens, France',
[WARN]        subtitleHighlightRanges: []
[WARN]      }
[WARN]    ],
[WARN]    bubbles: true,
[WARN]    type: 'didUpdateResults',
[WARN]    source: Object {},
[WARN]    cancelBubble: false
[WARN]  }

@m1ga
Copy link
Contributor

m1ga commented Sep 23, 2023

only used the zip from the first comment

@hansemannn
Copy link
Contributor Author

So the latest one works? :)

@m1ga
Copy link
Contributor

m1ga commented Sep 23, 2023

yes, now it works 👍

@hansemannn hansemannn merged commit 94ff4b9 into tidev:master Sep 23, 2023
3 checks passed
@hansemannn hansemannn deleted the feature/search-completion-apis branch September 23, 2023 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants