1

I am currently trying to integrate Paypal's MECL in an already existing IOS project using ARC.

I believe that by manually removing all the release / retain in the code should make it ARC compatible.

There is only one statement I do not know how to convert: "InitAndDealloc" that can be find in several class such as here:

static NSString *SolutionTypeStrings[] = {@"Sole", @"Mark"};
static NSString *LandingPageTypeStrings[] = {@"LandingPage", @"Billing", @"Login"};
static NSString *ChannelTypeStrings[] = {@"Merchant", @"eBayItem"};

#define LOCALE_CODE @"LocaleCode"

@implementation SetExpressCheckoutRequestDetails

InitAndDealloc

StringAccessor(ReturnURL)
StringAccessor(CancelURL)
StringAccessor1(cppHeaderImage, @"cpp-header-image")
StringAccessor1(cppHeaderBorderColor, @"cpp-header-border-color")
StringAccessor1(cppHeaderBackColor, @"cpp-header-back-color")
StringAccessor1(cppPayflowColor, @"cpp-payflow-color")
IntAccessor(AllowNote)
IntAccessor(ReqConfirmShipping)
TypedefAccessor(NoShipping, NoShippingType)
StringAccessor(Token)
AmountAccessor(MaxAmount)
StringAccessor(CallbackURL)
IntAccessor(CallbackTimeout)
GenericAccessor1(FlatRateShippingOptions, ShippingOptions)
IntAccessor(AddressOverride)
StringAccessor(PageStyle)
StringAccessor(BuyerEmail)
StringAccessor(giropaySuccessURL)
StringAccessor(giropayCancelURL)
StringAccessor(BanktxnPendingURL)
GenericAccessor(EnhancedCheckoutData)
GenericAccessor(BuyerDetails)
StringAccessor(BrandName)
GenericAccessor(FundingSourceDetails)
StringAccessor(CustomerServiceNumber)
IntAccessor(GiftMessageEnable)
IntAccessor(GiftReceiptEnable)
IntAccessor(GiftWrapEnable)
StringAccessor(GiftWrapName)
AmountAccessor(GiftWrapAmount)
IntAccessor(BuyerEmailOptinEnable)
StringAccessor(SurveyQuestion)
StringAccessor(CallbackVersion)
IntAccessor(SurveyEnable)
MutableArrayAccessor(PaymentDetails)
MutableArrayAccessor(BillingAgreementDetails)
MutableArrayAccessor1(OtherPaymentMethods, OtherPaymentMethodDetails)
MutableArrayAccessor1(SurveyChoice, NSString)
EnumAccessor(SolutionType, SolutionType)
EnumAccessor(LandingPage, LandingPageType);
EnumAccessor(ChannelType, ChannelType);

If I remove the line "InitAndDealloc", it seems as if I cannot set the variables anymore in the class. Indeed, I have also the working (Non ARC) paypal demo.

By doing this:

SetExpressCheckoutRequestDetails *sreq = [[SetExpressCheckoutRequestDetails alloc] init];
sreq.ReturnURL = @"Bob";
NSLog(@"%@  ", sreq.ReturnURL );

In both projects. Mine will return null, paypal's will return the Bob.

Has it even got anything to do with "InitAndDealloc" or am I looking at it wrong? If it is how do I replace "InitAndDealloc" in an ARC project? I can't seem to find a simple "Init" with autocompletion and by googling "InitAndDealloc" I get absolutely no results whatsoever :/

Thanks for reading!

Philipp Schlösser
  • 5,179
  • 2
  • 38
  • 52

1 Answers1

1

I've never used MECL before but the way it's being called "InitAndDealloc" certainly is not Objective C and therefore wouldn't be subject to the same rules that ARC requires for Objective C. Best to leave it in place and not try to futz or struggle with it.

But anyways, instead of struggling with trying to ARC-enable some published & potentially-problematic SDK code, why not turn ARC off for the MECL files?

Here is a related question that describes how to turn ARC off for individual files.

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215