问题标签 [xcode7-beta3]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
527 浏览

objective-c - Swift 2.0 与 Objective C 的互操作没有按预期工作?

我正在将 Swift 1.2 框架移植到 2.0。在通过新的 Swift 2.0 错误处理方案修复了 300 万个编译器错误后,我终于能够链接我的测试应用程序(用 Objective C 编写)以使用更新的框架。

Xcode 版本 7.0 beta 3 (7A121l)

但是,我遇到了一个问题。某些 Swift 函数不再生成到 Objective C 测试应用程序使用的自动生成的 Objective C 标头 (MyFramework-Swift.h) 中。

这是一个未公开的函数示例:(我的实际框架函数返回了一个枚举,但我试图简化以更清楚地说明问题)。

请注意,像下面这样的其他函数实际上确实会按预期公开(并且可以调用):

这是Objective C方面:

通过观看此视频,我曾期望它应该“正常工作”:

https://developer.apple.com/videos/wwdc/2015/?id=401

...但似乎我们目前不能使用既抛出又返回值的函数。

这是一个错误,还是未实现的功能?如果我在某处遗漏了发行说明中的​​某些内容,我深表歉意。

任何建议表示赞赏。

0 投票
1 回答
1366 浏览

xcode - 整数溢出在 Swift 中给出 EXC_BAD_INSTRUCTION

在玩弄 Swift 时,我注意到当 64 位整数溢出时,我收到以下错误:

file:///Users/user/Documents/playground/MyPlayground.playground/:错误:游乐场执行中止:执行被中断,原因:EXC_BAD_INSTRUCTION(代码=EXC_I386_INVOP,子代码=0x0)。

第一次调用,即以 92 作为参数,将运行良好。然而,当提供 93 值时,我得到了不相关的 EXC_BAD_INSTRUCTION 错误。这是一个错误还是什么?通常我希望它会溢出。

0 投票
1 回答
1784 浏览

ios - iOS 8上的UITableView背景黑色和空单元格黑色

Xcode 7.0b3 iOS 部署目标 8.0

这是我为隔离问题而制作的测试应用程序。

在一个中创建了UITableViewController一个UINavigationController。点击一个单元格,然后推动另一个表格视图控制器。此表视图控制器在每个部分中具有随机数量的部分和行。

在运行 iOS 9 的 iPhone 上,表格可以正确滚动......空单元格是 while。在运行 iOS 8 的 iPhone 上,表格有黑色背景。空行是黑色而不是白色。

在我们的“真实”应用中,我们有时会在新的 UITableView 中看到旧 UITableView 的内容。所以我试图隔离这个问题,看看它是否是 Xcode 7 测试版的错误。

这听起来像是使用 beta xcode 并使用 iOS 8 构建的错误吗?还是我们创造了一个错误/做错了什么?

0 投票
1 回答
2288 浏览

ios - Xcode 7 调试模式是否有效?

使用 Xcode 7 测试版 3

下面的代码无法#if DEBUG正确输入语句。我几乎可以肯定我处于调试模式,但由于某种原因,以下代码不起作用:

我的方案如下所示: 构建方案配置

我正在运行应用程序cmd + R

我配置不正确吗?

0 投票
2 回答
850 浏览

wkwebview - 使用 Xcode 7 beta3 在 WKWebView 中加载 url 的问题

我正在对 WKWebView 进行快速测试以评估其优缺点。但我发现我能够使用 Xcode 6.4 和 iOS 8 加载 url,但在 Xcode 7 beta 3 中加载相同的 URL 时遇到问题。

这就是我正在做的事情:

我做错了什么还是只是 Xcode 和 iOS 9 的测试版?谢谢,

0 投票
2 回答
5172 浏览

xcodebuild - 如何在 Xcode 7 中使用带有 watch 扩展的 xcodebuild

我们的命令以前是这样的

现在在 Xcode 7 中,我们得到这个错误:

我们如何指定使用 iOS 9.0 SDK 和 watchos 2.0 SDK?

0 投票
1 回答
389 浏览

ios - 更新到 Swift 2.0 后的自动布局问题

下载 Xcode 7.0 并迁移到 Swift 2.0 后,我收到以下错误。

尝试将此 NSLayoutConstraint 添加到它已经存在的引擎中。这可能会导致引擎损坏。中断 void _NSLayoutConstraintRedundantAdd() 进行调试。这将只记录一次。这可能会在未来打破。

0 投票
1 回答
2497 浏览

ios - 无法将 GoogleMaps 导入 Xcode 7 中的框架

我有一个新项目,我正在使用通过 cocoapods 导入的 GoogleMaps 使用 XCode 7 beta 3 和 Swift 2.0。这是一个 WatchKit 2.0 应用程序,所以我有一个 iPhone 的主要目标(目的地)、一个 Apple Watch 的目标(目的地 WatchKitApp 和目的地 WatchKitExtension)和一个内部框架(目的地Kit),它负责与 GoogleMaps 交互其他事情。

我可以成功地将 GoogleMaps 导入到主要目标(目的地)并成功显示地图。

上面的代码导入了我的内部框架 DestinationsKit,并成功使用了 GoogleMaps。

但是,我现在正在编写计算两点之间路线的代码,并将该代码添加到内部框架 (DestinationsKit)。每当我尝试导入 GoogleMaps 时,我都会收到“没有这样的模块 'GoogleMaps'”。

我做了以下没有成功:

  • 'In Build Phases' -> 'Link Binary With Libraries',我添加了 Pods.Framework (这是我在主要目标中成功所做的)
  • 将“允许框架模块中的非模块化包含”设置为是
  • 在构建设置中将“打包”->“定义模块”设置为“是”

我的 Pods 文件如下:

我确保 Pods.Framework 包含在两个目标中。因此,我无法弄清楚为什么主要目标可以找到 GoogleMaps,但我的内部框架却找不到。

提前致谢!

0 投票
1 回答
2807 浏览

ios - Building a Swift Framework with Xcode 7 (Beta 3) to use as an Embedded Binary

Ever since Embedded Binaries were introduced in iOS 8, I have been wanting to port a lot of my common code into frameworks. I decided to wait one year before doing it and this year, with Xcode 7 Beta and iOS 9, I'm starting to do that just that.

I have started a Cocoa Touch framework project in Xcode 7 and I want to compile it into a usable framework. I can get it to compile my project into a .framework, but there's a few issues; namely, the framework doesn't appear to be importable into new projects (I will describe the steps I did for that shortly). Because of that, I'm not sure if my framework has any visible symbols.

This is what I have done to create the Framework:

  1. Created my Framework as a Cocoa Touch Framework.
  2. Went to my target's Build Phases, went to Headers, and added all my Swift files to the "Public" section, in hopes that will export all my simbols without having to mark them as public.
  3. I tried to archive my project as a framework. Currently, it looks like Xcode 7 Beta 3 has a bug (going to report it later today) in which it generates corrupted archive files. For this reason I couldn't get my framework from the Organizer Window. To work around this, I changed the schema of the Run action in Xcode from Debug to Release, built it and grabbed it's generated .framework from my project's build/iphoneos-release directory. This was a quick test so I didn't need the frameworks generated for emulators.

And this is what I did to try to add the framework to a new project:

  1. Created a "Frameworks" group (for organizational purposes) and dragged the framework there, selecting "yes" when it asked me if I want to copy the file to my project's directory.
  2. Went to my target's settings, removed my framework from "Linked Libraries" (it was added there automatically), added it to Embedded Binaries instead. This added the framework to Linked Libraries again, so I had to remove it from there twice. Leaving the framework in Linked Libraries causes a linker error (can't find the framework - no idea why but I think it's irrelevant to my problem and something I should report to Apple as well), but once you remove it from there it seems to compile fine when you add it to Embedded Binaries.
  3. Tried to import my framework in a file. Xcode complains there is "no such module".

Unfortunately, despite the fact that embedded frameworks have been around for around a year, I can't find much writing on the topic.

So my question is: Am I creating the framework correctly, making it possible that my framework/anything else is failing due to an Xcode 7 Beta bug? Or is there a different procedure to create a framework that I want to use as an Embedded Binary? I should probably mention that I want to make this library open source, and I think distributing a plain .framework file to the people who want to use it would be neat.

0 投票
2 回答
26255 浏览

ios - 如何在 Swift/Xcode 中为按钮设置图像

尝试以编程方式设置按钮的图像时收到“nil”错误。我究竟做错了什么?这些都不是可选项。