2

Hi In past I had developed one application which supports IOS6.Now the time came to support the same app for IOS7 also. For supporting the app for IOS6 & IOS7 I increased the Y value of each and every component by 20 pixels.

Here I am getting the OS version by using[[[UIDevice CurrentDevice]SystemVersion] floatvalue]; method.Based on that OS version I am changing the rect values for each and every component.

For handling the StatusbarStyle I am using the following methods in IOS7

 1. [self setNeedsStatusBarAppearanceUpdate];
 2.-(UIStatusBarStyle)preferredStatusBarStyle;

These methods are working fine in IOS7, But if I install the app in IOS6 the app is crashing due to the above two methods.

So now my requirement is I have to hide or not execute IOS7 related methods or changes in IOS6 Device.With the help of this Implementation I hope I can resolve the issue.

Even I used few methods to resolve this crash issue.The methods which I used are

1. #if __IPHONE_OS_VERSION_MAX_ALLOWED== 70000
2.#if __IPHONE_OS_VERSION_MIN_REQUIRED==70000

Here while creating the ipa file deployment Target Which I had set is 6.0. Because I have to support IOS6 & IOS7.

So please help me to resolve this issue. Thanks in Advance.

4

2 回答 2

7

执行此操作的使用NSFoundationVersionNumber条件支持 iOS 6

在此处输入图像描述

如果您需要为不同的应用版本加载不同的资源——并且您当前在Info.plist文件中标识了故事板或 XIB文件——</p>

您可以使用版本Foundation framework来确定当前系统版本并在application:didFinishLaunchingWithOptions:中加载适当的资源。下面的代码展示了如何检查 Foundation 框架版本:

 if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {

    // Load resources for iOS 6.1 or earlier

    } else {

    // Load resources for iOS 7 or later

    }

看看你想要的同一件事的最佳答案

iOS 7 状态栏在 iPhone 应用程序中回到 iOS 6 默认样式?

于 2013-09-26T05:50:00.003 回答
1

尝试检查这种情况:

if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
    // iOS 7
} else {
    // iOS 6
}
于 2013-09-26T05:50:42.057 回答