XCode 7警告!是为新iOS版本(5.1.1)构建的,而不是链接(5.1)

时间:2022-10-12 17:08:10

I upgraded xcode 6 project to xcode 7 and started seeing the warning was built for newer iOS version (5.1.1) than being linked (5.1).

我将xcode 6项目升级到xcode 7,并开始看到新的iOS版本(5.1.1)的警告,而不是链接(5.1)。

How to fix this warning?

如何修正这个警告?

8 个解决方案

#1


18  

In my case, this warning was produced because the iOS-Deployment-Target of one of my XCode subprojects was higher (7.1) than in my baseproject (7.0). If you use cococapods, this misconfiguration can happen when you specify a wrong iOS platform version in your Podfile. In my example, I specified in my Podfile

在我的例子中,这个警告是产生的,因为我的XCode子项目之一的ios - deploytarget比我的baseproject(7.0)要高(7.1)。如果使用cococapods,在您的Podfile中指定一个错误的iOS平台版本时,会发生这种错误配置。在我的例子中,我在Podfile中指定。

platform :ios, '7.1' 

whereas I set the Deployment-Target in my XCode-Project to iOS 7.0. Setting the DeploymentTarget of the Subproject to the same iOS Version as the BaseProject fixes this warning.

而我在xcode项目中设置了部署目标到ios7.0。将子项目的部署目标设置为与BaseProject相同的iOS版本,以修复此警告。

#2


10  

Update: seems to be resolved with Xcode 7.3 (7D175). I've removed the -w flag, the warning no longer appears.

更新:似乎可以用Xcode 7.3 (7D175)解决。我已经移除-w标志,警告不再出现。

This appears to be a known bug in Xcode 7.0 and 7.1B1 (bug #21813082).

这似乎是Xcode 7.0和7.1B1 (bug #21813082)中的一个已知bug。

As a temporary workaround, to suppress extensive warnings, the -w flag can be added to Build Settings -> Other Linker Flags:

作为一个临时工作区,为了抑制广泛的警告,可以添加-w标志来构建设置->其他链接标记:

  1. Select your Project
  2. 选择您的项目
  3. Select your Target
  4. 选择你的目标
  5. Select "Build Settings" tab
  6. 选择“构建设置”选项卡
  7. Scroll down to "Linking"
  8. 向下滚动到“链接”
  9. Edit "Other Linker Flags" and add "-w"
  10. 编辑“其他链接标记”并添加“-w”

I've only added this to the Debug build settings and inserted the following to the AppDelegate, just as reminder:

我只将此添加到调试构建设置中,并将以下内容插入到AppDelegate中,就像提醒:

#ifdef DEBUG
#warning Linker warnings suppressed (-w in build settings)
#endif

This at least helps to quickly spot the real warnings instead of having the build results flooded with the same warning for every source (in my case 150+ warnings appeared).

这至少有助于快速发现真正的警告,而不是让构建结果充斥着对每个源的相同警告(在我的例子中出现了150多个警告)。

#3


6  

In my case, I upgraded the project to iOS 6, but the problem didn't go away.

在我的例子中,我将项目升级到iOS 6,但问题并没有消失。

Then I realised the target was overriding it as iOS 5.1.1. I cleared the target settings and the warnings went away.

然后我意识到目标是把它重写成ios5.1.1。我清除了目标设置,警告就消失了。

XCode Version 7.0 (7A220).

XCode 7.0版本(7 a220)。

XCode 7警告!是为新iOS版本(5.1.1)构建的,而不是链接(5.1)

#4


4  

In my case, I had my project set to 8.4 but all the rest of the subprojects/targets are still on 9.0. Appears like it is caused by deployment target inconsistencies.

在我的例子中,我的项目设置为8.4,但是所有其他的子项目/目标仍然是9.0。看起来是由部署目标不一致引起的。

For those who are using Cocoapods:

对于那些使用Cocoapods的人:

  1. Navigate through your Pod projects and targets.
  2. 浏览您的Pod项目和目标。
  3. Change all the deployment targets to your desired one.
  4. 将所有部署目标更改为您想要的。

Make sure all of them are similar.

确保它们都是相似的。

#5


1  

try add "-w" on "Linking->Other Linker Flags".

尝试在“链接->其他链接标记”上添加“-w”。

This happening in my case when mySDK built with base SDK greater than development target myProject.

这发生在我的案例中,当mySDK以基础SDK构建时,比开发目标myProject更大。

#6


1  

In my case the deployment target in the project section (7.0) was different to the target deployment targets (8.0). So check your deployment targets for your project and every single target in your project to be the same.

在我的情况下,项目部分(7.0)中的部署目标与目标部署目标(8.0)不同。因此,检查您的项目的部署目标和项目中的每个目标都是相同的。

#7


0  

In my case I built the libraries with latest iOS but the app's deployment target is lower than that. So I think there is nothing I can do except adding -w to other linker flag

在我的例子中,我用最新的iOS构建了库,但是应用程序的部署目标要比这个低。所以我认为除了向其他链接器添加-w之外,我什么也做不了。

#8


0  

First change iOS Deployment Target under Project then change Deployment Target under Targets. Delete file at /Users/yourUser/Library/Developer/Xcode/DerivedData (rm -rf yourProject). Pod install again then say bye to warning.

首先,在项目下更改iOS部署目标,然后根据目标更改部署目标。删除文件/用户/yourUser/Library/Developer/Xcode/DerivedData (rm -rf yourProject)。再次安装Pod,然后对警告说再见。

#1


18  

In my case, this warning was produced because the iOS-Deployment-Target of one of my XCode subprojects was higher (7.1) than in my baseproject (7.0). If you use cococapods, this misconfiguration can happen when you specify a wrong iOS platform version in your Podfile. In my example, I specified in my Podfile

在我的例子中,这个警告是产生的,因为我的XCode子项目之一的ios - deploytarget比我的baseproject(7.0)要高(7.1)。如果使用cococapods,在您的Podfile中指定一个错误的iOS平台版本时,会发生这种错误配置。在我的例子中,我在Podfile中指定。

platform :ios, '7.1' 

whereas I set the Deployment-Target in my XCode-Project to iOS 7.0. Setting the DeploymentTarget of the Subproject to the same iOS Version as the BaseProject fixes this warning.

而我在xcode项目中设置了部署目标到ios7.0。将子项目的部署目标设置为与BaseProject相同的iOS版本,以修复此警告。

#2


10  

Update: seems to be resolved with Xcode 7.3 (7D175). I've removed the -w flag, the warning no longer appears.

更新:似乎可以用Xcode 7.3 (7D175)解决。我已经移除-w标志,警告不再出现。

This appears to be a known bug in Xcode 7.0 and 7.1B1 (bug #21813082).

这似乎是Xcode 7.0和7.1B1 (bug #21813082)中的一个已知bug。

As a temporary workaround, to suppress extensive warnings, the -w flag can be added to Build Settings -> Other Linker Flags:

作为一个临时工作区,为了抑制广泛的警告,可以添加-w标志来构建设置->其他链接标记:

  1. Select your Project
  2. 选择您的项目
  3. Select your Target
  4. 选择你的目标
  5. Select "Build Settings" tab
  6. 选择“构建设置”选项卡
  7. Scroll down to "Linking"
  8. 向下滚动到“链接”
  9. Edit "Other Linker Flags" and add "-w"
  10. 编辑“其他链接标记”并添加“-w”

I've only added this to the Debug build settings and inserted the following to the AppDelegate, just as reminder:

我只将此添加到调试构建设置中,并将以下内容插入到AppDelegate中,就像提醒:

#ifdef DEBUG
#warning Linker warnings suppressed (-w in build settings)
#endif

This at least helps to quickly spot the real warnings instead of having the build results flooded with the same warning for every source (in my case 150+ warnings appeared).

这至少有助于快速发现真正的警告,而不是让构建结果充斥着对每个源的相同警告(在我的例子中出现了150多个警告)。

#3


6  

In my case, I upgraded the project to iOS 6, but the problem didn't go away.

在我的例子中,我将项目升级到iOS 6,但问题并没有消失。

Then I realised the target was overriding it as iOS 5.1.1. I cleared the target settings and the warnings went away.

然后我意识到目标是把它重写成ios5.1.1。我清除了目标设置,警告就消失了。

XCode Version 7.0 (7A220).

XCode 7.0版本(7 a220)。

XCode 7警告!是为新iOS版本(5.1.1)构建的,而不是链接(5.1)

#4


4  

In my case, I had my project set to 8.4 but all the rest of the subprojects/targets are still on 9.0. Appears like it is caused by deployment target inconsistencies.

在我的例子中,我的项目设置为8.4,但是所有其他的子项目/目标仍然是9.0。看起来是由部署目标不一致引起的。

For those who are using Cocoapods:

对于那些使用Cocoapods的人:

  1. Navigate through your Pod projects and targets.
  2. 浏览您的Pod项目和目标。
  3. Change all the deployment targets to your desired one.
  4. 将所有部署目标更改为您想要的。

Make sure all of them are similar.

确保它们都是相似的。

#5


1  

try add "-w" on "Linking->Other Linker Flags".

尝试在“链接->其他链接标记”上添加“-w”。

This happening in my case when mySDK built with base SDK greater than development target myProject.

这发生在我的案例中,当mySDK以基础SDK构建时,比开发目标myProject更大。

#6


1  

In my case the deployment target in the project section (7.0) was different to the target deployment targets (8.0). So check your deployment targets for your project and every single target in your project to be the same.

在我的情况下,项目部分(7.0)中的部署目标与目标部署目标(8.0)不同。因此,检查您的项目的部署目标和项目中的每个目标都是相同的。

#7


0  

In my case I built the libraries with latest iOS but the app's deployment target is lower than that. So I think there is nothing I can do except adding -w to other linker flag

在我的例子中,我用最新的iOS构建了库,但是应用程序的部署目标要比这个低。所以我认为除了向其他链接器添加-w之外,我什么也做不了。

#8


0  

First change iOS Deployment Target under Project then change Deployment Target under Targets. Delete file at /Users/yourUser/Library/Developer/Xcode/DerivedData (rm -rf yourProject). Pod install again then say bye to warning.

首先,在项目下更改iOS部署目标,然后根据目标更改部署目标。删除文件/用户/yourUser/Library/Developer/Xcode/DerivedData (rm -rf yourProject)。再次安装Pod,然后对警告说再见。