Coder Social home page Coder Social logo

Comments (25)

j3k0 avatar j3k0 commented on July 24, 2024

Hello!

Yes, I'm just done working on a project using it. It's on the store and it works, so the plugin is certainly safe to use.

I didn't try on Cordova 3.0 yet however, I use PhoneGap 2.7.0.

from cordova-plugin-purchase.

mlegenhausen avatar mlegenhausen commented on July 24, 2024

It seems PhoneGap 3.0 ios project has ARC enabled as default. When compiling this code it is not working.

from cordova-plugin-purchase.

jkirkell avatar jkirkell commented on July 24, 2024

I am using the plugin with Cordova 3.0x and it works for the most part. The main issue is that the config.xml needs to be updated to change the plugin tag to be a feature tag.

from cordova-plugin-purchase.

guiix-code avatar guiix-code commented on July 24, 2024

I second the issue of ARC problems. There are several uses of the release function, e.g. [numberFormatter release];, that are not permitted.

from cordova-plugin-purchase.

damrbaby avatar damrbaby commented on July 24, 2024

FYI you can get around ARC restrictions by following these instructions for InAppPurchase.m and SKProduct+LocalizedPrice.m

Also for PhoneGap >= 3.0 this plugin can be installed with a single command:

cordova plugin add git://github.com/j3k0/PhoneGap-InAppPurchase-iOS.git

from cordova-plugin-purchase.

areoburn avatar areoburn commented on July 24, 2024

I setup the plugin through the cordova plugin command on Phonegap 3.0

I made sure the xml file has the feature tags and everything is in the right places.

I have been trying to get the plugin to work but for some reason storekit isn't being recognized from the beginning. I am running it inside the device ready function.

Can someone please look into this? I've been bashing my head on this for hours and couldn't get it to work.

from cordova-plugin-purchase.

jkirkell avatar jkirkell commented on July 24, 2024

take a look at https://github.com/jkirkell/cordova-inapp-sample which is just the steps to follow for setting up using InApp purchasing plugins. The code is for reference only and should not be run since I excluded the binaries.

from cordova-plugin-purchase.

areoburn avatar areoburn commented on July 24, 2024

jkirkell thank you very much for the fast reply! I checked my project and everything is setup perfectly. I am sorry I miss worded my problem. I found the exact problem.

When I do:
storekit.load(['inapp1', 'inapp2'], function (products, invalidIds) {});

The callback function does not run.

InAppPurchase[objc]: Getting products data
InAppPurchase[objc]: Set has 2 elements
InAppPurchase[objc]: - inapp1
InAppPurchase[objc]: - inapp2
InAppPurchase[objc]: start

That's about all I receive. I tried setting alerts and a variety of other tests inside the callback, but nothing seems to work.

It would be of great help if someone can help figure this out because I noticed many people were experiencing this problem on the guide page as well.

from cordova-plugin-purchase.

guiix-code avatar guiix-code commented on July 24, 2024

If you know a little Objective-C, when you compile and come up with errors, you can go through the list and click on each to highlight the problem lines, then you can comment out (add "//" to the beginning of the line) any line that just has release on it. There's one line that has some other initialisation too, where you would just remove the "release" part, and not the rest.

from cordova-plugin-purchase.

jkirkell avatar jkirkell commented on July 24, 2024

@areoburn I now see what you are seeing, but only when I compile and push to IOS7 in the simulator. IOS6.1 still works fine. I am looking at it and will report back later today.

from cordova-plugin-purchase.

jkirkell avatar jkirkell commented on July 24, 2024

The super quick answer is that the code works fine when using the simulator for IOS6.1 only. IOS7 and IOS7 64bit both are croaking with the storekit initialization. I will keep working on it.

from cordova-plugin-purchase.

damrbaby avatar damrbaby commented on July 24, 2024

I thought you can't test storekit in the simulator? I wouldn't expect it to work in the simulator at all.

from cordova-plugin-purchase.

jkirkell avatar jkirkell commented on July 24, 2024

For anyone looking, Apple is not letting the simulator to run in-app purchases per their notes https://developer.apple.com/library/ios/releasenotes/DeveloperTools/RN-Xcode/index.html.

StoreKit (In-App purchases) will not work in the Simulator. 13962338

I have tested the current code on a device running IOS7 (iPhone5) and sandbox in-app purchasing works.

from cordova-plugin-purchase.

areoburn avatar areoburn commented on July 24, 2024

Thank you jkirkell! I finally can continue working on my app!

Has anyone experienced this problem with the callback function?

var IAP_loaded = false; // Global Scope
var IAP_onReady = function(){
storekit.load(IAP_list, function (products, invalidIds) {
console.log('IAP LOADING...');
IAP_products = products;
IAP_loaded = true;
console.log("1] -- IAP Loaded: "+IAP_loaded); // Outputs true
});
console.log("2] -- IAP Loaded: "+IAP_loaded); // Outputs false
IAP_loaded = true;
console.log("3] -- IAP Loaded: "+IAP_loaded); // Outputs true
};

console.log("4] -- IAP Loaded: "+IAP_loaded); // Outputs false

For some my global variables aren't staying modified outside the function itself...
I created a completely separate function and changed a global variable and it works fine. This just mind baffles me. Any thoughts?

from cordova-plugin-purchase.

areoburn avatar areoburn commented on July 24, 2024

Never mind, I figured out storekit is being run as async and I came across a solution. Thanks again for the help

from cordova-plugin-purchase.

areoburn avatar areoburn commented on July 24, 2024

Hey have any of you experienced the Error message "Cannot connect to itunes" after a successful purchase restore? I seem to keep getting this error, but the purchase is going through.

Not sure if this is a sandbox environment error or not

from cordova-plugin-purchase.

jkirkell avatar jkirkell commented on July 24, 2024

Running in the simulator using a sandbox user on IOS6 or 6.1, I would see strange issues like

  • being forced to login twice when either buying or restoring
  • the cannot connect to iTunes message
  • the purchase and restore methods being executed multiple times

When I installed on a device and used the sandbox user, all that went away.

Hope that helps

from cordova-plugin-purchase.

tiendq avatar tiendq commented on July 24, 2024

For short, both methods work well:

  1. Add -fno-objc-arc flag to files as instructed here: https://github.com/jkirkell/cordova-inapp-sample
  2. Comment code as @doomsy pointed out. I prefer this way, error message is clear, isn't it?

Thanks,

from cordova-plugin-purchase.

guiix-code avatar guiix-code commented on July 24, 2024

The error messages are clear, though I ran into one app crash during my usage. I'm not sure if it was related specifically to what I commented out, but I ended up switching to the "Add -fno-objc-arc flag" option to keep things simple.

from cordova-plugin-purchase.

wootwoot1234 avatar wootwoot1234 commented on July 24, 2024

@jkirkell and @areoburn did you guys ever figure out a fix for the storekit.load(['inapp1', 'inapp2'], function (products, invalidIds) {}); callback? It connects to apple's servers and prints the information in the console but never calls the callback. BTW, I'm running these tests on an iPhone 5 with iOS 7.

from cordova-plugin-purchase.

jkirkell avatar jkirkell commented on July 24, 2024

Apple disabled running storekit through the IOS Simulator. When you install
on the device and login using the test accounts, everything works fine.

What I ended up doing in my code was to add a flag to add the product as a
"fake" purchase so my app can be tested still in the simulator.

Hope that helps.
Jeff

On Thu, Oct 3, 2013 at 10:46 AM, wootwoot1234 [email protected]:

@jkirkell https://github.com/jkirkell and @areoburnhttps://github.com/areoburndid you guys ever figure out a fix for the storekit.load(['inapp1',
'inapp2'], function (products, invalidIds) {}); callback? It connects to
apple's servers and prints the information in the console but never calls
the callback. BTW, I'm running these tests on an iPhone 5 with iOS 7.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-25626419
.

from cordova-plugin-purchase.

wootwoot1234 avatar wootwoot1234 commented on July 24, 2024

Hey Jeff. Thanks for the quick response. Good point. I always forget to login to my test account. I logged in and still the load callback isn't being called. I thought it might be a timing issue with the init function so I pulled the load function out of the ready callback and put it in a 'setTimeout()' which delayed the call by 1 second but that didn't help. Here's the console output:

Finished load of: file:///var/mobile/Applications/...app/www/index.html
 InAppPurchase[js]: setup ok
 InAppPurchase[js]: load [...]
InAppPurchase[objc]: Getting products data
InAppPurchase[objc]: Set has 13 elements
InAppPurchase[objc]: - ...
InAppPurchase[objc]: start
THREAD WARNING: ['InAppPurchase'] took '38.044922' ms. Plugin should use a background thread.
InAppPurchase[objc]: productsRequest: didReceiveResponse:
InAppPurchase[objc]: Has 13 validProducts
InAppPurchase[objc]: - ...
InAppPurchase[objc]: productsRequest: didReceiveResponse: sendPluginResult: (...)

Thanks for the help. I really like how you cleaned up this plugin. The log outputs are really helpful.

from cordova-plugin-purchase.

wootwoot1234 avatar wootwoot1234 commented on July 24, 2024

Here's my code (after removing the setTimeout()). Maybe I'm doing something wrong.

window.storekit.init({
    purchase: function (transactionId, productId, transactionReceipt) {
        console.log('purchased: ' + productId);
    },
    restore: function (transactionId, productId, transactionReceipt) {
        console.log('restored: ' + productId);
    },
    restoreCompleted: function () {
        console.log('restoreCompleted');
    },
    restoreFailed: function (errCode) {
        console.log('Error Code: ' + errCode);
    },
    error: function (errno, errtext) {
        console.log('failed: ' + errtext);
    },
    ready: function () {
        var productIds = ["..."];
        window.storekit.load(productIds, function(validProducts, invalidProductIds) {
            console.log("load callback");
            $.each(validProducts, function (i, val) {
                console.log("id: " + val.id + " title: " + val.title + " val: " + val.description + " price: " + val.price);
            });
            if(invalidProductIds.length) {
                console.log("Invalid Product IDs: " + JSON.stringify(invalidProductIds));
            }
        });
    }
});

from cordova-plugin-purchase.

wootwoot1234 avatar wootwoot1234 commented on July 24, 2024

Hey Jeff.

Never mind my last couple of comments. You're correct, it's working. I just stripped my code down to nothing but the in app purchase and the load callback fired so there's something wrong somewhere else.

Thanks again for this plugin.

Oh, one last thing. The readme.md file talks about some functions that no longer exist. If you want I'm happy to clean it up.

from cordova-plugin-purchase.

j3k0 avatar j3k0 commented on July 24, 2024

Hi wootwoot,
Of course feel free to clean the doc :) Any help to maintain this plugin is appreciated!

from cordova-plugin-purchase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.