If I compile it to device or simulator, it works well. But when I do Product --> Archive, it errors:

Login.m
! Semantic Issue
  Use of undeclared identifier 'kLogin_URL'

But this works on simulator and device

I am using Xcode version Version 4.6 (4H127). Here is the constant file.

#ifndef MyMobileApp_AllUrls_h
    #define MyMobileApp_AllUrls_h

    #ifdef QA
        #define kLogin_URL              @"https://b2bgateway.qa.mycompany.com/authenticate"
        #define ktran_URL               @"https://b2bgateway.qa.mycompany.com/.../lookup"

        #define LOGIN_REQUEST_TIMEOUT   15.0f
        #define TRAN_REQ_TIMEOUT        60.0f
    #endif

    #ifdef PROD
        #define kLogin_URL              @"https://b2bgateway.mycompany.com/authenticate"
        #define ktran_URL               @"https://b2bgateway.mycompany.com/.../lookup"

        #define LOGIN_REQUEST_TIMEOUT   15.0f
        #define TRAN_REQ_TIMEOUT        30.0f
    #endif
#endif

The contents of -prefix.pch is

#import <Availability.h>

#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
    #import "AllUrls.h"
#endif

Appreciate your inputs.

Thanks

有帮助吗?

解决方案

Make sure your build settings preprocessor macros include PROD under your release configuration.

Per your comment, Just wanted to make sure this is what you did.

#ifdef QA
    #define kLogin_URL              @"https://b2bgateway.qa.mycompany.com/authenticate"
    #define ktran_URL               @"https://b2bgateway.qa.mycompany.com/.../lookup"

    #define LOGIN_REQUEST_TIMEOUT   15.0f
    #define TRAN_REQ_TIMEOUT        60.0f
#else
    #define kLogin_URL              @"https://b2bgateway.mycompany.com/authenticate"
    #define ktran_URL               @"https://b2bgateway.mycompany.com/.../lookup"

    #define LOGIN_REQUEST_TIMEOUT   15.0f
    #define TRAN_REQ_TIMEOUT        30.0f
#endif
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top