{"action":"created","issue":{"url":"https://api.github.com/repos/j3k0/cordova-plugin-purchase/issues/281","labels_url":"https://api.github.com/repos/j3k0/cordova-plugin-purchase/issues/281/labels{/name}","comments_url":"https://api.github.com/repos/j3k0/cordova-plugin-purchase/issues/281/comments","events_url":"https://api.github.com/repos/j3k0/cordova-plugin-purchase/issues/281/events","html_url":"https://github.com/j3k0/cordova-plugin-purchase/issues/281","id":106430877,"number":281,"title":"Error with iOS Hosted Content","user":{"login":"G3n3ralTao","id":6233465,"avatar_url":"https://avatars.githubusercontent.com/u/6233465?v=3","gravatar_id":"","url":"https://api.github.com/users/G3n3ralTao","html_url":"https://github.com/G3n3ralTao","followers_url":"https://api.github.com/users/G3n3ralTao/followers","following_url":"https://api.github.com/users/G3n3ralTao/following{/other_user}","gists_url":"https://api.github.com/users/G3n3ralTao/gists{/gist_id}","starred_url":"https://api.github.com/users/G3n3ralTao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/G3n3ralTao/subscriptions","organizations_url":"https://api.github.com/users/G3n3ralTao/orgs","repos_url":"https://api.github.com/users/G3n3ralTao/repos","events_url":"https://api.github.com/users/G3n3ralTao/events{/privacy}","received_events_url":"https://api.github.com/users/G3n3ralTao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-14T21:21:51Z","updated_at":"2015-09-15T20:57:08Z","closed_at":null,"body":"I got some trouble with non-consumable purchase with content hosted on Apple servers.\r\nThe InApp are created in my account and I uploaded the content via ApplicationLoader and everything is alright on the iTunes page. I created this small js function to test the InApp:\r\n\r\n;\r\n\r\nstore.verbosity = store.DEBUG;\r\n\r\n        store.register({\r\n            id:    'com.test.testApp.testWithData', \r\n            alias: 'hosted content download',\r\n            type:   store.NON_CONSUMABLE\r\n        });\r\n\r\n        store.refresh();\r\n\r\n        /*\r\n         * iOS Apple-hosted content\r\n         */\r\n\r\n        // When purchase of the downloadable content is approved,\r\n        // show some logs.\r\n        store.when(\"hosted content download\").approved(function (product) {\r\n            console.log(\"You've purchased the content for \" + product.id + \" - it will now download to your device!\");\r\n            console.log(product);\r\n        });\r\n\r\n        // Show progress during hosted content download\r\n        store.when(\"hosted content download\").downloading(function(product) {\r\n            console.log(product.id + \" downloading!\");\r\n\r\n        });\r\n\r\n        // When hosted content download is complete, finish the transaction\r\n        store.when(\"hosted content download\").downloaded(function(product) {\r\n            console.log(product.id + \" downloaded!\");\r\n            product.finish();\r\n        });\r\n\r\n        // If the product content is downloading or downloaded, display the downloaded content\r\n        store.when(\"hosted content download\").updated(function (product) {\r\n            console.log(product.id + \" updated!\");\r\n            console.log(product);\r\n        });\r\n\r\n        store.refresh();\r\n\r\n        store.order(\"hosted content download\");\r\n\r\nI get an error when I try to bind callback on the functions downloading and downloaded:\r\n\"TypeError: undefined is not a function (store.when(\"hosted content download\").downloaded(function(product) {console.log(product.id + \" downloaded!\");product.finish();}))\"\r\n\r\nThe update callback is never called and I never get any notification that something is downloaded.\r\n\r\nI based myself on the demo at this address: \"https://github.com/dpa99c/cordova-plugin-purchase-demo/blob/master/www/js/index.js\". \r\n\r\nAnyone know what is going on?\r\n"},"comment":{"url":"https://api.github.com/repos/j3k0/cordova-plugin-purchase/issues/comments/140536802","html_url":"https://github.com/j3k0/cordova-plugin-purchase/issues/281#issuecomment-140536802","issue_url":"https://api.github.com/repos/j3k0/cordova-plugin-purchase/issues/281","id":140536802,"user":{"login":"dpa99c","id":2345062,"avatar_url":"https://avatars.githubusercontent.com/u/2345062?v=3","gravatar_id":"","url":"https://api.github.com/users/dpa99c","html_url":"https://github.com/dpa99c","followers_url":"https://api.github.com/users/dpa99c/followers","following_url":"https://api.github.com/users/dpa99c/following{/other_user}","gists_url":"https://api.github.com/users/dpa99c/gists{/gist_id}","starred_url":"https://api.github.com/users/dpa99c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpa99c/subscriptions","organizations_url":"https://api.github.com/users/dpa99c/orgs","repos_url":"https://api.github.com/users/dpa99c/repos","events_url":"https://api.github.com/users/dpa99c/events{/privacy}","received_events_url":"https://api.github.com/users/dpa99c/received_events","type":"User","site_admin":false},"created_at":"2015-09-15T20:57:08Z","updated_at":"2015-09-15T20:57:08Z","body":"If `store.downloaded` is not defined, I'd suspect that there's an issue with the plugin JS being included into the app. As you can see on [line 274 of store-ios.js](https://github.com/j3k0/cordova-plugin-purchase/blob/master/www/store-ios.js#L274), the `downloaded` promise is added.\r\n\r\nYou can try using the [remote debugging functionality of Safari](http://phonegap-tips.com/articles/debugging-ios-phonegap-apps-with-safaris-web-inspector.html) to step through the JS line-by-line and confirm what's causing the error."}}