Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7693761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:09:50+00:00 2026-05-31T21:09:50+00:00

Both the AuthNet and PayPal mobile payment libraries have the ENV_LIVE enumerator defined. This

  • 0

Both the AuthNet and PayPal mobile payment libraries have the ENV_LIVE enumerator defined. This reults in Xcode errors like:

Redefinition of enumerator 'ENV_LIVE' ...

In cases like this where one cannot afford to simply change the source code of dependent frameworks, what are some workarounds available in objective-c syntax or xcode configuration?

INITIALLY:

#import "PayPal.h"
#import "AuthNet.h"
...
// AuthNet
[AuthNet authNetWithEnvironment:ENV_TEST];

// PayPal
if (STATUS_COMPLETED_SUCCESS == [PayPal initializationStatus]) {
    [PayPal initializeWithAppID:@"APP-XXX" forEnvironment:ENV_SANDBOX];
}

UPDATE (here’s what I ended up using as a workaround based on the correct answer):

#import "PayPal.h"
@class AuthNet;
#import "AuthNetWorkaround.h"
...
[AuthNet authNetWithEnvironment:AUTHNET_ENV_TEST];

extern const int AUTHNET_ENV_LIVE;
extern const int AUTHNET_ENV_TEST;

@interface AuthNetWorkaround : NSObject

@end

#import "AuthNetWorkaround.h"
#import "AuthNet.h"

@implementation AuthNetWorkaround

const int AUTHNET_ENV_LIVE = ENV_LIVE;
const int AUTHNET_ENV_TEST = ENV_TEST;

@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T21:09:51+00:00Added an answer on May 31, 2026 at 9:09 pm

    This happens because both inclusions happen in the same compilation unit. You can work around this problem by moving the inclusion of one of the enums into a separate compilation unit, at a cost of making the values of that enumerator non-compile-time constants (in fact, they become global variables).

    In pp_workaround.h:

    extern const int PAYPAL_ENV_LIVE;
    

    In pp_workaround.m:

    #import "PayPal.h" // I'm completely making up the name of PayPal's header
    // The import of "AuthNet.h" is missing
    
    const int PAYPAL_ENV_LIVE = ENV_LIVE;
    

    Now you can include "pp_workaround.h" instead of "PayPal.h", and use PAYPAL_ENV_LIVE instead of ENV_LIVE. Not everything will work the same, but the compile-time error should be gone.

    EDIT If your code lets you import the conflicting headers only in your .m file, you can fix the problem (rather than working around it) by wrapping the connection code in an additional abstraction layer of your own, like this:

    In the paypal_init.h:

    extern void connect_paypal();
    

    In the paypal_init.m:

    #import "PayPal.h"
    #import "paypal_init.h"
    
    void connect_paypal() {
        // Use ENV_LIVE from PayPal.h here
    }
    

    in the authnet_init.h:

    extern void connect_authnet();
    

    in the authnet_init.m:

    #import "AuthNet.h"
    #import "authnet_init.h"
    
    void connect_authnet() {
        // Use ENV_LIVE from AuthNet.h here
    }
    

    In your main file:

    #import "authnet_init.h"
    #import "paypal_init.h"
    
    void init() {
        connect_paypal();
        connect_authnet();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Both of my callback methods have update_attributes in them. So it looks like when
Both the jQuery and Prototpye JavaScript libraries refuse to allow me to use a
Both are mathematical values, however the float does have more precision. Is that the
Both DataSource and DataSourceID are defined on 'grdCommunication'. Remove one definition. I just got
Both ideone.com and codepad.org have Little-Endian architechtures. I want to test my code on
Both Wikipedia and this site describe a similar step in the Simulated Annealing algorithm,
Both offer policies which have to be enforced and are similar in operation. There
Both Macro expansion & Code generation have pros & cons. What's your favorite approach
Both QWebFrame and QWebPage have void loadFinished(bool ok) signal which can be used to
Both addons have good sides, SLIMV has better REPL(faster than vimclojure REPL), but vimclojure's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.