27

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).

How to fix this warning?

Cœur
  • 37,241
  • 25
  • 195
  • 267
last-Programmer
  • 985
  • 3
  • 9
  • 19
  • 3
    It is an Xcode 7.0 and 7.1 issue when linking to patch versions of iOS. When using `-miphoneos-version-min=5.1.1` with linker, it will only respect major+minor parts (5.1) of the version. – Cœur Dec 05 '15 at 07:28

10 Answers10

20

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

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.

mschwarz
  • 1,407
  • 1
  • 10
  • 7
11

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

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

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

  1. Select your Project
  2. Select your Target
  3. Select "Build Settings" tab
  4. Scroll down to "Linking"
  5. Edit "Other Linker Flags" and add "-w"

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

#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).

Frans
  • 780
  • 7
  • 20
  • Can you share the text of Apple Bug #21813082? It's not available at Open Radar http://openradar.appspot.com/21813082 – zmarties Oct 16 '15 at 12:54
  • I don't have the text, mine was closed as duplicate of 21813082. – Frans Oct 16 '15 at 18:45
  • 4
    This is not a solution it is just not showing the warnings:/ i guess better not to implement this so that you can be aware of other possible important warnings related to linker. – Mihriban Minaz Nov 20 '15 at 16:06
  • 2
    @MihribanMinaz that's why I describe it as workaround and ONLY added this to the debug build. For a release build I don't use this and check all warnings. – Frans Nov 24 '15 at 03:08
  • 1
    Not for me it isn't. 7.3.1 – cvb Jun 12 '16 at 12:45
  • @Chris, what iOS version do you have as deployment target, 5.1.1? – Frans Jun 12 '16 at 17:31
7

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

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

XCode Version 7.0 (7A220).

Target settings

Matt
  • 4,261
  • 4
  • 39
  • 60
5

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.

For those who are using Cocoapods:

  1. Navigate through your Pod projects and targets.
  2. Change all the deployment targets to your desired one.

Make sure all of them are similar.

Teffi
  • 2,498
  • 4
  • 21
  • 40
4

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

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

ihsan_husnul
  • 125
  • 1
  • 2
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.

1

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.

maazza
  • 7,016
  • 15
  • 63
  • 96
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

Qiulang
  • 10,295
  • 11
  • 80
  • 129
0

I my case I changed the Deployment Target in the targets without changing the same in the project.

To solve the issue, I changed the Deployment Target on both the project and the Targets then I make pod update.

double-beep
  • 5,031
  • 17
  • 33
  • 41
Firas Shrourou
  • 625
  • 8
  • 19
0

Just in case anyone suffers the same bewilderment as myself: I discovered that I had an Xcode beta on an external hard drive and the system was selecting the tools on that drive instead of the internal drive. (Presumably because they were the newer beta tools?)... Ejecting the drive solved my issue!

double-beep
  • 5,031
  • 17
  • 33
  • 41