[ 
https://issues.apache.org/jira/browse/CB-12310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15794975#comment-15794975
 ] 

Bednarik Boldizsar commented on CB-12310:
-----------------------------------------

It looks like that the problem is caused by an incompatibility between the 
purchase plugin and onesignal plugin with version higher than 2.0.4, when I 
downgraded it to 2.0.4 the issue disappeared. related issue: 

https://github.com/j3k0/cordova-plugin-purchase/issues/537

> 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
>              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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to