{"id":21903864,"url":"https://github.com/hansemannn/titanium-parse-live-query","last_synced_at":"2025-09-01T20:34:24.229Z","repository":{"id":40666178,"uuid":"128920196","full_name":"hansemannn/titanium-parse-live-query","owner":"hansemannn","description":"Use the Parse \u0026 Parse Live Query SDK's in Axway Titanium.","archived":false,"fork":false,"pushed_at":"2023-08-14T15:37:40.000Z","size":37663,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T01:12:02.915Z","etag":null,"topics":["appcelerator","ios","javascript","native","parse","parse-live-query","titanium"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hansemannn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-10T11:12:39.000Z","updated_at":"2022-12-21T08:38:56.000Z","dependencies_parsed_at":"2024-11-28T15:32:51.331Z","dependency_job_id":"cfa7464b-f50f-40a1-b85c-39e53f2773e5","html_url":"https://github.com/hansemannn/titanium-parse-live-query","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hansemannn%2Ftitanium-parse-live-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hansemannn%2Ftitanium-parse-live-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hansemannn%2Ftitanium-parse-live-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hansemannn%2Ftitanium-parse-live-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hansemannn","download_url":"https://codeload.github.com/hansemannn/titanium-parse-live-query/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249151966,"owners_count":21221157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appcelerator","ios","javascript","native","parse","parse-live-query","titanium"],"created_at":"2024-11-28T15:29:51.165Z","updated_at":"2025-04-15T20:44:15.008Z","avatar_url":"https://github.com/hansemannn.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Parse Live Query in Titanium\n\nUse the Parse \u0026 Parse Live Query iOS and Android SDK's in Axway Titanium! Read more about the Parse Live Query API \nin the official native repositories:\n\n- iOS: https://github.com/parse-community/ParseLiveQuery-iOS-OSX\n- Android: https://github.com/parse-community/ParseLiveQuery-Android\n\n\u003e Warning: While iOS is ready for production, Android is highly dependent on community contributions. Submit a pull request\nto expose new features, e.g. query subscriptions.\n\n## Requirements\n\n- [x] iOS: Swift 5+ (embedded into the hook in `hooks/`), iOS 9.2.0+\n- [x] Android: Gradle, Android 4.1+\n- [x] Titanium SDK 9.2.0+\n\n## Usage with Ti.Facenook\n\nIf you use this module together with Ti.Facebook, you need to remove the `Bolts.framework` from\n```\n\u003cproject\u003e/modules/iphone/ti.facebook/\u003cversion\u003e/platform/Bolts.framework\n```\nsince it is already bundled with Ti.LiveQuery. Remember: In case you remove Ti.LiveQuery, put the framework\nback in our replace it with a fresh module version that contains the framework.\n\n## Setup\n\n### iOS\n\nNo additional setup required.\n\n### Android\n\nAdd the following to the `\u003candroid\u003e` manifest section of the tiapp.xml:\n```xml\n\u003capplication ...\u003e\n  ...\n  \u003cmeta-data android:name=\"com.parse.SERVER_URL\" android:value=\"YOUR_SERVER_URL\" /\u003e\n  \u003cmeta-data android:name=\"com.parse.APPLICATION_ID\" android:value=\"YOUR_APP_ID\" /\u003e\n\u003c/application\u003e\n```\n\n## API'S\n\n### Root-Module\n\n#### Methods\n\n##### `initialize(args: Dictionary)`\n\n- `applicationId` (String)\n- `clientKey` (String)\n- `server` (String)\n- `localDatastoreEnabled` (Boolean)\n\n##### `createClient(args: Dictionary)` **iOS only**\n\n- `applicationId` (String)\n- `clientKey` (String)\n- `server` (String)\n\n##### `saveObject(args)`\n\n- `className` (String)\n- `parameters` (Dictionary)\n- `callback` (Function)\n\n##### `clearAllCachedResults()`\n\n##### `objectWithClassName(className)` **iOS only**\n\n##### `becomeInBackground(args)` **iOS only**\n\n- `sessionToken` (String)\n- `callback` (Function - optional)\n\n#### Constants **iOS only**\n\n##### EVENT_TYPE_ENTERED\n##### EVENT_TYPE_LEFT\n##### EVENT_TYPE_CREATED\n##### EVENT_TYPE_UPDATED\n##### EVENT_TYPE_DELETED\n\n---\n\n### `Client` **iOS only**\n\n#### Methods\n\n#####  `reconnect()`\n\n#####  `disconnect()`\n\n#####  `isConnected()` -\u003e Boolean\n\n##### `subscribeToQuery(query)`\n\n- `query` (`Query`)\n\n##### `unsubscribeFromQuery(query)`\n\n- `query` (`Query`)\n\n#### Events **iOS only**\n\n##### `subscribe`\n\n- `query` (`Query`)\n\n##### `unsubscribe`\n\n- `query` (`Query`)\n\n##### `event`\n\n- `eventType` (`EVENT_TYPE_*`)\n- `object` (`Object`)\n- `query` (`Query`)\n\n##### `error`\n\n- `error` (String)\n- `query` (`Query`)\n\n---\n\n### `Query` **iOS only**\n\n#### Initializer (`createQuery(args)`)\n\n- `className` (String)\n- `predicate` (String, optional, e.g. `name = \"hans\"`)\n- `predicateArguments` (String, optional, e.g. `myUsers`)\n\nNote: When using `predicateArguments`, you write a template based placeholder inside the `predicate` parameter\nand fill it with the arguments passed in `predicateArguments`, e.g.\n```\nvar query = LiveQuery.createQuery({\n  className: 'User',\n  predicate: 'userId in %@'\n  predicateArguments: users // an array of users\n});\n```\n\nNote: If you use predicates, you may constraint your query for additional `where` clauses.\n\n#### Methods\n\n##### `whereKeyContainedIn(key, array)` -\u003e `Query`\n\n- `key` (String)\n- `array` (Array\u003cAny\u003e)\n\n##### `whereKeyNotContainedIn(key, array)` -\u003e `Query`\n\n- `key` (String)\n- `array` (Array\u003cAny\u003e)\n\n##### `whereKeyContainsAllObjectsInArray(key, array)` -\u003e `Query`\n\n- `key` (String)\n- `array` (Array\u003cAny\u003e)\n\n##### `whereKeyEqualTo(key, object)` -\u003e `Query`\n\n- `key` (String)\n- `object` (Any)\n\n##### `whereKeyNotEqualTo(key, object)` -\u003e `Query`\n\n- `key` (String)\n- `object` (Any)\n\n##### `whereKeyLessThan(key, object)` -\u003e `Query`\n\n- `key` (String)\n- `object` (Any)\n\n##### `whereKeyLessThanOrEqualTo(key, object)` -\u003e `Query`\n\n- `key` (String)\n- `object` (Any)\n\n##### `whereKeyGreaterThan(key, object)` -\u003e `Query`\n\n- `key` (String)\n- `object` (Any)\n\n##### `whereKeyGreaterThanOrEqualTo(key, object)` -\u003e `Query`\n\n- `key` (String)\n- `object` (Any)\n\n##### `whereKeyExists(key)` -\u003e `Query`\n\n- `key` (String)\n\n##### `whereKeyDoesNotExist(key)` -\u003e `Query`\n\n- `key` (String)\n\n##### `includeKeys(keys)` -\u003e `Query`\n\n- `keys` (Array\u003cString\u003e)\n\n##### `selectKeys(keys)` -\u003e `Query`\n\n- `keys` (Array\u003cString\u003e)\n\n##### `orderByAscending(key)` -\u003e `Query`\n\n- `key` (String)\n\n##### `orderByDescending(key)` -\u003e `Query`\n\n- `key` (String)\n\n##### `findObjectsInBackground(callback)`\n\n- `callback` (Function)\n\n##### `getObjectInBackgroundWithId(objectId)`\n\n##### `clearCachedResult()`\n\n---\n\n### `Object` **iOS only**\n\n#### Properties\n\n##### `parseClassName` (String)\n\n##### `objectId` (String)\n\n##### `createdAt` (String)\n\n##### `updatedAt` (String)\n\n##### `allKeys` (Array\u003cString\u003e)\n\n#### Methods\n\n##### `objectForKey(key)` -\u003e Any\n\n##### `setObjectForKey(object, key)`\n\n##### `removeObjectForKey(key)` \n\n##### `signUpInBackgroundWithBlock({ username, password, email, callback })`\n\n- `username`: The unique username of the user.\n- `password`: The unique password of the user.\n- `email`: The email address of the user.\n- `callback`: The callback to be invoked if the user has been created (success: true) or if something went wrong (success: false, error: xxx)\n\n##### `logInWithUsernameInBackground({ username, password callback })`\n\n- `username`: The unique username of the user.\n- `password`: The unique password of the user.\n- `callback`: The callback to be invoked if the user has been logged in (success: true, sessionToken: xxx) or if something went wrong (success: false, error: xxx)\n\n##### `logOutInBackground({ callback })` \n\n- `callback`: The callback to be invoked if the user has been logged out (success: true) or if something went wrong (success: false, error: xxx)\n\n##### `deleteObject(callback)` -\u003e Varying \n\nIf a callback function is used, it will be called asynchronous. Otherwise, it returns\na synchronous boolean indicating if it was completed successfully or not.\n\n##### `saveObject(callback)` -\u003e Varying\n\nIf a callback function is used, it will be called asynchronous. Otherwise, it returns\na synchronous boolean indicating if it was completed successfully or not.\n\n##### `fetchInBackground(callback)`\n\nThe callback is optional.\n\n##### `pinInBackground(callback)`\n\nThe callback is optional.\n\n##### `unpinInBackground(callback)`\n\nThe callback is optional.\n\n##### `fetchFromLocalDatastoreInBackground(callback)`\n\nThe callback is optional.\n\n##### `saveEventually(callback)`\n\nThe callback is optional.\n\n##### `deleteEventually()`\n\n## Compile native libraries\n\n### iOS\n\nThis project uses the following 5 Swift dependencies:\n\n- Bolds\n- BoldsSwift\n- Parse\n- ParseLiveQuery\n- Starscream\n\nWhile `Bolds` and `Parse` are Obj-C based, the others are dynamic Swift libraries. This projects resolves\nall dependencies already for you, including setting the Swift version using the hook placed in `hooks/`.\n\nRight now, Titanium only supports CocoaPods for Hyperloop, so in order to use it for classic modules, you need\nto create universal \"fat\" frameworks and strip the unused architectures again (this is taken care of by the SDK already).\nA universal library can be created by grabbing the frameworks from `Debug-iphonesimulator` (Simulator architectures) \nand `Debug-iphoneos` (Device architectures) and combine them using the following commands:\n\n0. Install CocoaPods (`sudo gem install cocoapods`) and run `pod install` in the `native/` directory of this repository\n1. Create the following folder structures: `sim/`, `device/` \u0026 `universal/`\n2. Copy the .framework files from `Debug-iphonesimulator` to `sim/`\n3. Copy the .framework files from `Debug-iphoneos` to `device/`\n4. Copy the .framework files from `device` to `universal/` (they are the base for universal frameworks)\n5. For `BoldsSwift` and `ParseLiveQuery`, copy the `Modules/*.swiftmodule` to the universal directory of the framework\n6. Use the following command to merge the sim- and device-frameworks together:\n```bash\nlipo -create -output universal/\u003cname\u003e.framework/\u003cname\u003e sim/\u003cname\u003e.framework/\u003cname\u003e device/\u003cname\u003e.framework/\u003cname\u003e\n```\n7. Replace the final frameworks in `\u003cmodule-project\u003e/platform`\n8. Make a pull request to this repo, so others can benefit from it as well\n\nThese steps are based on a [Shell Script](https://gist.github.com/cromandini/1a9c4aeab27ca84f5d79) used natively.\n\nNote: In the future, this will all be done by CocoaPods. Make sure to follow [TIMOB-25927](https://jira.appcelerator.org/browse/TIMOB-25927) regarding Swift support in the SDK.\n\n### Android\n\n0. Install Gradle and go to `android/`\n1. Run `gradle getDeps`\n2. Validate that the libraries are copied to `lib/`\n\n## Example\n\n```js\nvar ParseLiveQuery = require('ti.livequery');\n\nvar win = Ti.UI.createWindow({\n  backgroundColor: '#fff'\n});\n\nvar btn1 = Ti.UI.createButton({\n  title: 'Initialize Parse',\n  top: 100\n});\n\nvar btn2 = Ti.UI.createButton({\n  title: 'Subscribe',\n  top: 200\n});\n\nbtn1.addEventListener('click', function() {\n  ParseLiveQuery.initialize({\n    applicationId: '',\n    clientKey: '',\n    server: ''\n  });\n});\n\n// iOS only\nbtn2.addEventListener('click', function() {\n  var client = ParseLiveQuery.createClient({\n    applicationId: '',\n    clientKey: '',\n    server: ''\n  });\n\n  client.addEventListener('subscribe', function(e) {\n    Ti.API.info('Subscribed!');\n    // Subscribed\n  });\n\n  client.addEventListener('unsubscribe', function(e) {\n    Ti.API.info('Unsubscribed!');\n    // Unsubscribed\n  });\n\n  client.addEventListener('event', function(e) {\n    Ti.API.info('Event!');\n\n    printObject(e.object);\n\n    // Event received, check with e.type\n  });\n\n  client.addEventListener('error', function(e) {\n    Ti.API.info('Error!');\n    Ti.API.info(e.error);\n    // Error received, check with e.error\n  });\n\n  var query = ParseLiveQuery.createQuery({\n    className: 'Posts',\n    predicate: 'name = \"Hans\"'\n  });\n\n  client.subscribeToQuery(query);\n\n  // Get existing objects\n  query.findObjectsInBackground(function(e) {\n    Ti.API.info(e);\n    var objects = e.objects;\n\n    for (var i = 0; i \u003c objects.length; i++) {\n      printObject(objects[i]);\n    }\n  })\n});\n\n// Utility method to print objects by using \"objectForKey\"\nfunction printObject(object) {\n  var allKeys = object.allKeys;\n\n  for (var i = 0; i \u003c allKeys.length; i++) {\n    var key = allKeys[i];\n    var value = object.objectForKey(key);\n    Ti.API.info(key + ' = ' + value);\n  }\n}\n\nwin.add(btn1);\nwin.add(btn2);\n\nwin.open();\n```\n\n## Author\nHans Knöchel ([@hansemannnn](https://twitter.com/hansemannnn) / [Web](http://hans-knoechel.de))\n\n## License\nApache 2.0\n\n## Contributing\nCode contributions are greatly appreciated, please submit a new [Pull-Request](https://github.com/hansemannn/titanium-parse-live-query/pull/new/master)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhansemannn%2Ftitanium-parse-live-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhansemannn%2Ftitanium-parse-live-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhansemannn%2Ftitanium-parse-live-query/lists"}