Cannot build source code in Xcode 4.1 with iOS 4.3

2019-07-18 00:10发布

I have been developing in Xcode 4.1 with iphone of iOS 4.3.5. It was fine without a version mismatch problem. Today, I connected another iphone which has the same version of iOS (4.3.5) and I could not build source code on to the device. The organizer window said,

The version of iOS on “Hee’s iPhone” does not match any of the versions of iOS supported for development with this installation of the iOS SDK. Please restore the device to a version of the OS listed below, or update to the latest version of the iOS SDK; which is available here.

I know it will be solved if I update Xcode or downgrade iPhone. However, I want to know other options if there are any. I really wonder why some devices are fine but others are not.

1条回答
ゆ 、 Hurt°
2楼-- · 2019-07-18 00:45

You can put additional SDKs/Symbols for the iPhoneOS/iPhoneSimulator platforms inside:

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/[insert ios version folder here]

and

/Developer/Platforms/iPhoneOS.platform/DeviceSupport/[insert ios version folder here]

What I do is download old xcode and new beta xcode, install them to something like /Developer-3.2.3/, then symlink/alias the folders above from the /Developer-3.2.3 to the /Developer.

This lets my 4.1 xcode test on an iOS5.0 phone! The directory paths above might not be exact as I am writing this from my phone but they areaomething close to that. When I get back to my computer I will make sure those directories are correct.

For the simulator versions it would be:

/Developer/Platforms/iPhoneSimulator.platform/SDK/...

Edit (back at my computer):

Here is what my Developer directories looks like:

[ 17:49 root@MacBookPro / ]# ll
drwxrwxr-x+ 44 root      admin      1.5K Sep 20 12:37 Applications
drwxrwxr-x  15 root      admin      510B Sep 20 13:27 Developer
drwxrwxr-x@ 17 root      admin      578B Sep 20 13:12 Developer-3.2.4
drwxr-xr-x@ 10 root      admin      340B Sep 20 13:54 Developer-3.2.5
drwxrwxr-x@ 18 root      admin      612B Sep 20 13:44 Developer-4.2-beta7

[ 17:46 root@MacBookPro /Developer/Platforms/iPhoneOS.platform/Developer/SDKs ]# ll
lrwxr-xr-x  1 root  wheel    75B Sep 20 13:53 iPhoneOS3.2.sdk -> /Developer-3.2.4/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk
drwxr-xr-x  8 root  wheel   272B Sep 20 13:26 iPhoneOS4.3.sdk
lrwxr-xr-x  1 root  wheel    79B Sep 21 12:50 iPhoneOS5.0.sdk -> /Developer-4.2-beta7/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk

[ 17:46 root@MacBookPro /Developer/Platforms/iPhoneOS.platform/Developer ]# cd ../../DeviceSupport/
[ 17:46 root@MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]# ll
drwxrwxr-x  5 root      admin   170B Sep 20 13:26 3.0
drwxrwxr-x  5 root      admin   170B Sep 20 13:26 3.1
drwxrwxr-x  5 root      admin   170B Sep 20 13:26 3.1.2
drwxrwxr-x  5 root      admin   170B Sep 20 13:26 3.1.3
drwxrwxr-x  5 root      admin   170B Sep 20 13:26 3.2
drwxrwxr-x  5 root      admin   170B Sep 20 13:26 3.2.1
drwxrwxr-x  5 root      admin   170B Sep 20 13:26 3.2.2
drwxrwxr-x  5 root      admin   170B Sep 20 13:26 4.0
drwxrwxr-x  5 root      admin   170B Sep 20 13:26 4.0.1
drwxrwxr-x  5 root      admin   170B Sep 20 13:26 4.0.2
drwxrwxr-x  5 root      admin   170B Sep 20 13:26 4.1
drwxrwxr-x  5 root      admin   170B Sep 20 13:26 4.2
drwxrwxr-x  5 root      admin   170B Sep 20 13:26 4.3
lrwxr-xr-x  1 root      admin    77B Sep 21 12:54 5.0 (9A5313e) -> /Developer-4.2-beta7/Platforms/iPhoneOS.platform/DeviceSupport/5.0 (9A5313e)/
lrwxr-xr-x  1 root      admin    13B Sep 21 12:54 Latest -> 5.0 (9A5313e)
[ 17:46 root@MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]#

In order to do this, you need to install the different versions of Xcode that have different iOS SDKs. To achieve the above, I only installed Xcode 3.2.4, 3.2.4, 4.1, and 4.2 (beta). I use 4.1 as my main /Developer directory.

Once each Xcode is installed into seperate locations, this is how you would symlink the Symbols/SDKs directories from a non-primary Xcode install to your main install path:

/Developer/Platforms/iPhoneOS.platform/DeviceSupport
[ 17:54 root@MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]# cd /Developer/Platforms/iPhoneOS.platform/DeviceSupport
[ 17:54 root@MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]# ln -sf "/Developer-4.2-beta7/Platforms/iPhoneOS.platform/DeviceSupport/5.0 (9A5313e)/" "5.0 (9A5313e)"
[ 17:54 root@MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]# cd ../Developer/SDKs
[ 17:54 root@MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]# ln -sf "/Developer-3.2.4/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk" "iPhoneOS3.2.sdk"
[ 17:54 root@MacBookPro /Developer/Platforms/iPhoneOS.platform/DeviceSupport ]# ln -sf "/Developer-4.2-beta7/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk" "iPhoneOS5.0.sdk"

After symlinking each SDK/Symbol directory in your main /Developer/Platforms/iPhoneOS.platform/DeviceSupport and /Developer/Platforms/iPhoneOS.platform/Developer/SDKs directories, open up Xcode, and you should be able to see your device and use it to test builds, etc.


Edit 2 (commands explained):

ll is an alias I made for the ls -l command:

[ 18:07 root@MacBookPro / ]# alias
cd..='cd ..'
cls='clear'
df='/usr/local/bin/df.nawk'
du='du -L'
l='ls -lsG'
ldir='ls -d */'
ll='ls -lhG'
ls='ls -G'
lsdir='ls -d */'
text='open -a TextWrangler'
v='ls -lhG'
vi='vim'
vu='vim'
vv='du . --max-depth=1 -L | sort -n | cut -f2 | xargs -d "\n" du -sh -L'
xcode='open -a xcode'

ln (symlink) is a command to create a shortcut/alias. The (very basic) syntax is:

 [ 18:07 root@MacBookPro / ]# ln -s [TARGET_PATH] [LINK_NAME]

Here is the ln man page

Here is the ls man page

查看更多
登录 后发表回答