Errors ONLY while doing Product --> Archive with semantic issue - ios

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

Related

Update Instance Metric in RPL Contiki

I would like to know how often does the instance->mc.obj.xxxx updated in RPL Contiki 3. And also how can I change it to be updated more frequently. I have tried the following in rpl-conf.h:
#ifdef RPL_CONF_DIO_INTERVAL_MIN
#define RPL_DIO_INTERVAL_MIN RPL_CONF_DIO_INTERVAL_MIN
#else
//#define RPL_DIO_INTERVAL_MIN 12
#define RPL_DIO_INTERVAL_MIN 6
#endif
#ifdef RPL_CONF_DIO_INTERVAL_DOUBLINGS
#define RPL_DIO_INTERVAL_DOUBLINGS RPL_CONF_DIO_INTERVAL_DOUBLINGS
#else
//#define RPL_DIO_INTERVAL_DOUBLINGS 8
#define RPL_DIO_INTERVAL_DOUBLINGS 1
#endif
But it did not give me what I'm expecting. Your help is much appreciated.
Thanks

OpenCV iOS - Expected identifier (MACRO)

Getting error from "opencv2.framework".
Just a new project contained "opencv2.framework" not running.
My Steps:
download latest opencv2.framework
add required frameworks
declare .pch file stuff
changed .m file -> .mm
Am I missing something?
#ifndef PrefixHeader_pch
#define PrefixHeader_pch
#import <Availability.h>
#ifndef __IPHONE_4_0
#warning "This project uses features only available in iOS SDK 4.0 and later."
#endif
#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
#endif /* PrefixHeader_pch */
Line 46 says it all: You have to put opencv.hpp before any Apple's headers. In PrefixHeader.pch move
#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#endif
up and before
#import <Availability.h>

Header file not executing if else case

My project contains 3 targets and it requires some credential details specific to target. I have defines.h file where I am checking the current target and then initialising constants.
#ifdef XYZ44DEV
#define COM_CMS_URL #"http://xyz.portal.com"
#define COM_CMS_USER #"test"
#define COM_CMS_PASS #"test"
#elif XYZ44UAT
#define COM_CMS_URL #"http://xyz.uat.portal.com"
#define COM_CMS_USER #"uat"
#define COM_CMS_PASS #"uat"
#else
#define COM_CMS_URL #"http://xyz.prod.portal.com"
#define COM_CMS_USER #"Prod"
#define COM_CMS_PASS #"Prod"
#endif
Any target I run, it goes to else case and takes COM_CMS_USER & COM_CMS_PASS as "Prod". Please let me know, what i am missing here.
You need to add preprocessor Macros in build settings as illustrated in image
the output for
NSLog(#"%#",COM_CMS_USER);
is
2016-05-20 11:58:05.315 CustomKeyboard[2952:687530] test
You have to set preprocessing macro in build setting
image 1 : You have to add macro for each your target
image 2 : For macro , you can set only supported versions

Importing AFNetworking without pod

I want to add AFNetworking without pod and source code to my project. I started by adding source code and then following libraries.
Then I added prefix file
#import <Availability.h>
#if __IPHONE_OS_VERSION_MIN_REQUIRED
#ifndef __IPHONE_6_0
#warning "This project uses features only available in iPhone SDK 6.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
#endif
#else
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <AssertMacros.h>
#import <CoreServices/CoreServices.h>
#endif
#endif
And add prefix file to Build Settings -> Apple LLVM 6.1 - Language -> Prefix Header.
After that I built project and I got following errors:
Implicit declaration of function 'SecItemExport' is invalid in C99
Use of undeclared identifier 'kSecFormatUnknown' Use of undeclared
identifier 'kSecItemPemArmour'
Which all are in a file and line. AFSecurity Policy.m, line 31. Which is:
__Require_noErr_Quiet(SecItemExport(key, kSecFormatUnknown, kSecItemPemArmour, NULL, &data), _out);
When I comment this line of code, which is not correct, the rest of project is built completely.
What should I do and why those errors happened?
I found the answer on github.
As mentioned in the release notes for 2.6, if you are installing the library manually you will need to define the following variables in your project's pch:
#ifndef TARGET_OS_IOS
#define TARGET_OS_IOS TARGET_OS_IPHONE
#endif
#ifndef TARGET_OS_WATCH
#define TARGET_OS_WATCH 0
#endif
Github Link.
My solution is to add "TARGET_OS_IOS=1" at Preprocessor Macros -- Build Settings

How can I verify whether my app supports iOS 4.3 or not

I compiled my app with sdk 6.1 and set the deployment target to iOS 4.3. Does this mean that my app can run on 4.3? I don't have such device and can't actually test it but I would like to know if the app would work on 4.3.
Setting the deployment target to iOS 4.3 ensures your app supports iOS 4.3 and above unless you are not using any features that only supports in higher versions like ARC, Storyboard, autolayout. It is better to test on a device or simulator. You can download the iOS4.3 simulator through Xcode
Xcode-> preferances -> downloads -> iOS 4.3 simulator
if you feel that the class which you have used might not be available in the other ios version then you can check the same using
Using the NSClassFromString function. Pass the name of your class to this method as a string.
If the return value of this function is nil, that class is not available on the device that runs your app;
otherwise, that class is available on the device and you can go ahead and use it as you wish.
Here is an example:
i am checking for NSJSONSerialization class, similarly you can check for your class also,
if (NSClassFromString(#"NSJSONSerialization") != nil) {
/* You can use this class */
[NSJSONSerialization JSONObjectWithData:... /* Put data here */
options:... /* Put options here */
error:...]; /* Handle errors here */
} else {
/* That class is not available */
}
You can run on any device whose iOS version is greater then or equal to the deployment target set by you.
So keep in mind you have not used any framework or features that are not supported in that version.
Hope it helps you.
You can always test your app on 4.3 simulator. Select the iPhone 4.3 Simulator under the "Scheme" menu (you can find it on the right side of the "Run" "Stop" button on top of Xcode). If you cant find the option for 4.3 simulator then you need to download it by going to Xcode->Preference->Downloads->Components->iOS 4.3 Simulator
Sometimes the xcode will not complain about the usage of new features (like autolayout, etc) available in 6.1 but will crash the app when run on 4.3.
test in this way is a solution that works pretty well, but it is not 100% guaranteed
/**
* Example usage:
* If you want to see if you're using methods that are only defined in iOS 4.0 and lower
* then you would use the following. Replace the __IPHONE_4_0 with whatever other macro
* you require. See Availability.h for iOS versions these relate to.
*
* YourProjectPrefixHeader.pch:
* #define __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED __IPHONE_4_0
* #import "ThisFile.h"
*
* // The rest of your prefix header as normal
* #import <UIKit/UIKit.h>
*/
#import <Availability.h>
#define __AVAILABILITY_TOO_NEW __attribute__((deprecated("TOO NEW!")))
#ifndef __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED
#define __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED __IPHONE_OS_VERSION_MIN_REQUIRED
#endif
#if __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED < __IPHONE_OS_VERSION_MIN_REQUIRED
#error You cannot ask for a soft max version which is less than the deployment target
#endif
#if __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED < __IPHONE_2_0
#undef __AVAILABILITY_INTERNAL__IPHONE_2_0
#define __AVAILABILITY_INTERNAL__IPHONE_2_0 __AVAILABILITY_TOO_NEW
#endif
#if __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED < __IPHONE_2_1
#undef __AVAILABILITY_INTERNAL__IPHONE_2_1
#define __AVAILABILITY_INTERNAL__IPHONE_2_1 __AVAILABILITY_TOO_NEW
#endif
#if __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED < __IPHONE_2_2
#undef __AVAILABILITY_INTERNAL__IPHONE_2_2
#define __AVAILABILITY_INTERNAL__IPHONE_2_2 __AVAILABILITY_TOO_NEW
#endif
#if __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED < __IPHONE_3_0
#undef __AVAILABILITY_INTERNAL__IPHONE_3_0
#define __AVAILABILITY_INTERNAL__IPHONE_3_0 __AVAILABILITY_TOO_NEW
#endif
#if __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED < __IPHONE_3_1
#undef __AVAILABILITY_INTERNAL__IPHONE_3_1
#define __AVAILABILITY_INTERNAL__IPHONE_3_1 __AVAILABILITY_TOO_NEW
#endif
#if __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED < __IPHONE_3_2
#undef __AVAILABILITY_INTERNAL__IPHONE_3_2
#define __AVAILABILITY_INTERNAL__IPHONE_3_2 __AVAILABILITY_TOO_NEW
#endif
#if __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED < __IPHONE_4_0
#undef __AVAILABILITY_INTERNAL__IPHONE_4_0
#define __AVAILABILITY_INTERNAL__IPHONE_4_0 __AVAILABILITY_TOO_NEW
#endif
#if __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED < __IPHONE_4_1
#undef __AVAILABILITY_INTERNAL__IPHONE_4_1
#define __AVAILABILITY_INTERNAL__IPHONE_4_1 __AVAILABILITY_TOO_NEW
#endif
#if __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED < __IPHONE_4_2
#undef __AVAILABILITY_INTERNAL__IPHONE_4_2
#define __AVAILABILITY_INTERNAL__IPHONE_4_2 __AVAILABILITY_TOO_NEW
#endif
#if __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED < __IPHONE_4_3
#undef __AVAILABILITY_INTERNAL__IPHONE_4_3
#define __AVAILABILITY_INTERNAL__IPHONE_4_3 __AVAILABILITY_TOO_NEW
#endif
#if __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED < __IPHONE_5_0
#undef __AVAILABILITY_INTERNAL__IPHONE_5_0
#define __AVAILABILITY_INTERNAL__IPHONE_5_0 __AVAILABILITY_TOO_NEW
#endif

Resources