You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "jcesarmobile (JIRA)" <ji...@apache.org> on 2017/01/09 11:45:58 UTC

[jira] [Closed] (CB-12310) Getting EXC_BAD_ACCESS in xcode when trying to use any purchase plugin on IOS

     [ https://issues.apache.org/jira/browse/CB-12310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

jcesarmobile closed CB-12310.
-----------------------------
    Resolution: Not A Problem
      Assignee: jcesarmobile

Closing as this is a problem with the plugins, and both are 3rd party plugins.

> Getting EXC_BAD_ACCESS in xcode when trying to use any purchase plugin on IOS
> -----------------------------------------------------------------------------
>
>                 Key: CB-12310
>                 URL: https://issues.apache.org/jira/browse/CB-12310
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>         Environment: env:
> Cordova CLI: 6.0.0
> OS: Mac OS X El Capitan
> Xcode version: Xcode 8.2.1 Build version 8C1002
> plugins
> cc.fovea.cordova.purchase 6.0.0 "Purchase"
>            Reporter: Bednarik Boldizsar
>            Assignee: jcesarmobile
>              Labels: crash, ios, purchase
>
> I'm trying to use the https://github.com/AlexDisler/cordova-plugin-inapppurchase plugin in my ionic/cordova application, and I get an error in xcode when executing this code:
> ```
> var id = 'my_id';
> inAppPurchase
>   .getProducts([id]).then(function (products) {
>     // logging
>     inAppPurchase.subscribe(id).
>     then(function(data){
>     // logging
>   }).catch(function(err){
>     // logging
>   });
>   }).catch(function (err) {
>     // logging
> });
> ```
> I have tried with `ios 4.2.1` and `ios 4.3.1` as well, the problem comes up every time on 4.3.1 and sometimes but frequently on 4.2.1 ...
> here's what I get in xcode:
> ```
> Thread 1: EXC_BAD_ACCESS (code=1, address=0x600000028)
> ```
> this is in like 224 in `RMStore.m`
> `[[SKPaymentQueue defaultQueue] addPayment:payment];`
> here is the full function where the app dies:
> ```
> - (void)addPayment:(NSString*)productIdentifier
>               user:(NSString*)userIdentifier
>            success:(void (^)(SKPaymentTransaction *transaction))successBlock
>            failure:(void (^)(SKPaymentTransaction *transaction, NSError *error))failureBlock
> {
>     SKProduct *product = [self productForIdentifier:productIdentifier];
>     if (product == nil)
>     {
>         RMStoreLog(@"unknown product id %@", productIdentifier)
>         if (failureBlock != nil)
>         {
>             NSError *error = [NSError errorWithDomain:RMStoreErrorDomain code:RMStoreErrorCodeUnknownProductIdentifier userInfo:@{NSLocalizedDescriptionKey: NSLocalizedStringFromTable(@"Unknown product identifier", @"RMStore", @"Error description")}];
>             failureBlock(nil, error);
>         }
>         return;
>     }
>     SKMutablePayment *payment = [SKMutablePayment paymentWithProduct:product];
>     if ([payment respondsToSelector:@selector(setApplicationUsername:)])
>     {
>         payment.applicationUsername = userIdentifier;
>     }
>     
>     RMAddPaymentParameters *parameters = [[RMAddPaymentParameters alloc] init];
>     parameters.successBlock = successBlock;
>     parameters.failureBlock = failureBlock;
>     _addPaymentParameters[productIdentifier] = parameters;
>     
>     [[SKPaymentQueue defaultQueue] addPayment:payment];
> }
> ```
> this is the related code form xcode console:
> ```
> 2016-12-13 17:03:32.366881 app[385:27165] RMStore: products request received response
> 2016-12-13 17:03:32.367172 app[385:27165] RMStore: received product with id my_id
> ```
>  
> I'm using xcode 8.x ...
> I have been trying to solve this with no success so far. I tried to use different cordova versions, different cordova-ios versions and different versions of the plugin, the result is the same - the app crashes. The most frustrating thing is, sometimes it works, sometimes (most of the times) it does not ... and there's a pattern (sort of) when I run the app in XCode it usually works the first time, then if i kill the app, and start it from the phone it dies, then if I go to multitasking and click on the app again then it works ... the app dies right before (or maybe during) the purchase dialog appears. I have tried to create a totally new application, and reproduce the problem, could not do it - it showed the purchase dialog every time.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org