简体   繁体   English

Xcode 5和iOS 7:架构和有效架构

[英]Xcode 5 and iOS 7: Architecture and Valid architectures

I'm starting new project in Xcode 5. I want to develop application using iOS SDK 7 but with deployment target iOS 5.0 . 我正在Xcode 5中开始新项目。我想使用iOS SDK 7开发应用程序,但部署目标是iOS 5.0 As soon as I create new project in Xcode and try to change deployment target to 5.0, I've got this message: 一旦我在Xcode中创建新项目并尝试将部署目标更改为5.0,我就收到此消息:

Applications including an arm64 slice are not compatible with versions of iOS
prior to 6.0
Adjust your Architectures build setting to not include arm64 in order to deploy
to releases prior to iOS 6.0.

So changed architectures to Standard (no 64bit). 因此将架构更改为Standard (无64位)。 I compiles, runs but I do not really understand what just happend. 我编译,运行,但我真的不明白刚刚发生了什么。

What's the difference between Architectures and Valid architectures settings in Xcode project Build Settings? Xcode项目构建设置中的Valid architectures ArchitecturesValid architectures设置之间有什么区别?
If I set Architectures to exclude 64-bit what happens when I run my app on 64-bit iPhone or iOS Simulator (I know it works, I'm just curious what hapens underneath)? 如果我将Architectures设置为排除64位当我在64位iPhone或iOS模拟器上运行我的应用程序时会发生什么(我知道它有效,我只是好奇下面有什么问题)?
Can you explain big mess with new 64-bit architecture? 你能用新的64位架构来解释大混乱吗?

在此输入图像描述

Set the architecture in build setting to Standard architectures(armv7,armv7s) 将构建设置中的体系结构设置为标准体系结构(armv7,armv7s)

在此输入图像描述

iPhone 5S is powered by A7 64bit processor. iPhone 5S采用A7 64位处理器。 From apple docs 来自苹果文档

Xcode can build your app with both 32-bit and 64-bit binaries included. Xcode可以构建包含32位和64位二进制文​​件的应用程序。 This combined binary requires a minimum deployment target of iOS 7 or later. 这种组合二进制文件需要iOS 7或更高版本的最低部署目标。

Note: A future version of Xcode will let you create a single app that supports the 32-bit runtime on iOS 6 and later, and that supports the 64-bit runtime on iOS 7. 注意:Xcode的未来版本将允许您创建一个支持iOS 6及更高版本上的32位运行时的应用程序,并支持iOS 7上的64位运行时。

From the documentation what i understood is 从文档中我理解的是

  • Xcode can create both 64bit 32bit binaries for a single app but the deployment target should be iOS7. Xcode可以为单个应用程序创建64位32位二进制文​​件,但部署目标应该是iOS7。 They are saying in future it will be iOS 6.0 他们将来会说它将是iOS 6.0
  • 32 bit binary will work fine in iPhone 5S(64 bit processor). 32位二进制文​​件在iPhone 5S(64位处理器)中可以正常工作。

Update (Xcode 5.0.1) 更新(Xcode 5.0.1)
In Xcode 5.0.1 they added the support to create 64 bit binary for iOS 5.1.1 onwards. 在Xcode 5.0.1中,他们添加了对iOS 5.1.1以后创建64位二进制文​​件的支持。

Xcode 5.0.1 can build your app with both 32-bit and 64-bit binaries included. Xcode 5.0.1可以构建包含32位和64位二进制文​​件的应用程序。 This combined binary requires a minimum deployment target of iOS 5.1.1 or later. 此组合二进制文件需要iOS 5.1.1或更高版本的最低部署目标。 The 64-bit binary runs only on 64-bit devices running iOS 7.0.3 and later. 64位二进制文​​件仅在运行iOS 7.0.3及更高版本的64位设备上运行。

Update (Xcode 5.1) 更新(Xcode 5.1)
Xcode 5.1 made significant change in the architecture section. Xcode 5.1在架构部分做了重大改变。 This answer will be a followup for you. 这个答案将是您的后续跟进。 Check this 检查一下

When you set 64-bit the resulting binary is a "Fat" binary, which contains all three Mach-O images bundled with a thin fat header. 当你设置64位时,生成的二进制文件是一个“Fat”二进制文件,它包含所有三个与瘦胖文件头捆绑在一起的Mach-O图像。 You can see that using otool or jtool. 你可以看到使用otool或jtool。 You can check out some fat binaries included as part of the iOS 7.0 SDK, for example the AVFoundation Framework, like so: 您可以查看一些包含在iOS 7.0 SDK中的胖二进制文件,例如AVFoundation Framework,如下所示:

% cd  /Developer/Platforms/iPhoneOS.platform/DeviceSupport/7.0\ \(11A465\)/Symbols/System/Library/Frameworks/AVFoundation.framework/

%otool -V -f AVFoundation                                                                     9:36
Fat headers
fat_magic FAT_MAGIC
nfat_arch 3
architecture arm64     # The 64-bit version (A7)
    cputype CPU_TYPE_ARM64
    cpusubtype CPU_SUBTYPE_ARM64_ALL
    capabilities 0x0
    offset 16384
    size 2329888
    align 2^14 (16384)
architecture armv7        # A5X - packaged after the arm64version
    cputype CPU_TYPE_ARM
    cpusubtype CPU_SUBTYPE_ARM_V7
    capabilities 0x0
    offset 2359296
    size 2046336
    align 2^14 (16384)
architecture armv7s       # A6 - packaged after the armv7 version
    cputype CPU_TYPE_ARM
    cpusubtype CPU_SUBTYPE_ARM_V7S
    capabilities 0x0
    offset 4407296
    size 2046176
    align 2^14 (16384)

As for the binary itself, it uses the ARM64 bit instruction set, which is (mostly compatible with 32-bit, but) a totally different instruction set. 至于二进制本身,它使用ARM64位指令集,它(主要与32位兼容,但是)完全不同的指令集。 This is especially important for graphics program (using NEON instructions and registers). 这对于图形程序(使用NEON指令和寄存器)尤为重要。 Likewise, the CPU has more registers, which makes quite an impact on program speed. 同样,CPU有更多寄存器,这对程序速度有很大影响。 There's an interesting discussion in http://blogs.barrons.com/techtraderdaily/2013/09/19/apple-the-64-bit-question/?mod=yahoobarrons on whether or not this makes a difference; http://blogs.barrons.com/techtraderdaily/2013/09/19/apple-the-64-bit-question/?mod=yahoobarrons中有一个有趣的讨论是否会产生影响; benchmarking tests have so far clearly indicated that it does. 到目前为止,基准测试已明确表明它确实如此。

Using otool -tV will dump the assembly (if you have XCode 5 and later), and then you can see the instruction set differences for yourself. 使用otool -tV将转储程序集(如果你有XCode 5及更高版本),然后你可以看到自己的指令集差异。 Most (but not all) developers will remain agnostic to the changes, as for the most part they do not directly affect Obj-C (CG* APIs notwithstanding), and have to do more with low level pointer handling. 大多数(但不是全部)开发人员将对变化保持不可知,因为大多数情况下他们并不直接影响Obj-C(尽管CG * API),并且必须在低级指针处理方面做更多事情。 The compiler will work its magic and optimizations. 编译器将实现其魔术和优化。

My understanding from Apple Docs. 我对Apple Docs的理解。

  • What is Architectures (ARCHS) into Xcode build-settings? 什么是架构 (ARCHS)到Xcode构建设置?
    • Specifies architecture/s to which the binary is TARGETED . 指定二进制值为TARGETED的体系结构。 When specified more that one architecture, the generated binary may contain object code for each of the specified architecture. 当指定多于一个体系结构时,生成的二进制文件可以包含每个指定体系结构的目标代码。
  • What is Valid Architectures (VALID_ARCHS) into Xcode build-settings? 什么是有效架构 (VALID_ARCHS)到Xcode构建设置?

    • Specifies architecture/s for which the binary may be BUILT . 指定二进制可能为BUILT的架构。
    • During build process, this list is intersected with ARCHS and the resulting list specifies the architectures the binary can run on. 在构建过程中,此列表与ARCHS相交,结果列表指定二进制文件可以运行的体系结构。
  • Example :- One iOS project has following build-settings into Xcode. 示例: - 一个iOS项目在Xcode中具有以下构建设置。

    • ARCHS = armv7 armv7s ARCHS = armv7 armv7s
    • VALID_ARCHS = armv7 armv7s arm64 VALID_ARCHS = armv7 armv7s arm64
    • In this case, binary will be built for armv7 armv7s arm64 architectures. 在这种情况下,将为armv7 armv7s arm64架构构建二进制文件。 But the same binary will run on ONLY ARCHS = armv7 armv7s. 但是相同的二进制文件只能在ARCHS = armv7 armv7s上运行。

You do not need to limit your compiler to only armv7 and armv7s by removing arm64 setting from supported architectures. 通过从支持的体系结构中删除arm64设置,您无需将编译器限制为仅限armv7armv7s You just need to set Deployment target setting to 5.1.1 您只需将部署目标设置设置为5.1.1

Important note: you cannot set Deployment target to 5.1.1 in Build Settings section because it is drop-down only with fixed values. 重要说明:您无法在“ 构建设置”部分中将“部署目标”设置为5.1.1,因为它仅使用固定值下拉。 But you can easily set it to 5.1.1 in General section of application settings by just typing the value in text field. 但只需在文本字段中键入值,即可在应用程序设置的常规部分轻松将其设置为5.1.1。

Simple fix: 简单修复:

Targets -> Build Settings -> Build Options -> Enable Bitcode -> No 目标 - >构建设置 - >构建选项 - >启用Bitcode - >否

Works on device with iOS 9.3.3 适用于iOS 9.3.3的设备

None of the answers worked and then I was forgetting to set minimum deployment target which can be found in Project -> General -> Deployment Info -> Deployment Target -> 8.0 没有任何答案有效,然后我忘记设置最低部署目标,可以在项目 - > 常规 - > 部署信息 - > 部署目标 - > 8.0中找到

例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xcode 6和iOS8:体系结构和有效体系结构 - Xcode 6 and iOS8: Architectures and Valid Architectures Xcode:Universal \\ iOS4应用程序的体系结构设置 - Xcode: Architectures settings for a universal\iOS4 app Xcode如何在iOS SDK中配置架构 - Xcode How to configure Architectures in iOS SDK iOS App有效架构问题 - iOS App Valid Architecture issue 删除armv7s xCode 4.6有效架构项目属性如何影响我的iOS应用程序的App Store分发? - How does removing armv7s xCode 4.6 valid architecture project property affect App Store distribution of my iOS apps? 如何通过命令行工具更改Xcode有效架构? - How do I change Xcode Valid Architectures via the command line tool? 没有要编译的架构(archs = valid_archs = armv7 armv7s):OS 10.8.3 ios 6.1.3 - No architectures to compile for (archs= valid_archs=armv7 armv7s): OS 10.8.3 ios 6.1.3 ZBar与iOS7和XCode5编译错误libzbar.a架构 - ZBar with iOS7 and XCode5 compiling error libzbar.a architecture 对于使用XCode 4运行3.1.3的iPod Touch,“运行目标iOS设备无效” - “Run destination iOS Device is not valid” for iPod Touch running 3.1.3 with XCode 4 使用iOS 6 SDK和Xcode 4.5构建armv6架构(目标iOS 3.1.3)? - Build for armv6 architecture (target iOS 3.1.3) with iOS 6 SDK and Xcode 4.5?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM