问题标签 [xcode10.1]

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 回答
8913 浏览

xcode - 在 xcode 10.1 上添加可本地化的字符串

我有一个 swift 应用程序,现在我想使用 NSLocalizedString 为应用程序中使用的一些字符串添加翻译。

为了做到这一点,我在项目中添加了一个名为 Localizable.strings 的文件,并按下文件检查器中的“本地化”按钮,以便向其中添加多种语言。然而,本地化列表中只出现了英文,我似乎无法添加更多内容。

在查看了 SO 并四处搜索之后,许多关于如何执行此操作的文章都提到我应该在构建设置下为我的项目添加更多语言。但是我可以在本地化下更改的唯一设置是一个名为“本地化字符串宏名称”的设置,并且没有添加语言的选项。也没有“使用基本国际化”标记来检查。

我还尝试单击我的项目,然后单击编辑器-> 添加本地化,​​但是所有语言都显示为灰色,我无法选择其中任何一种。

因此,我认为您应该在最新版本的 xcode(10.1 atm)中以不同的方式执行此操作。谁能帮我弄清楚你应该怎么做?

在此处输入图像描述

0 投票
6 回答
14246 浏览

swift - Xcode10 - dyld:没有为框架中安装的 pod 加载库

我有一个带有目标框架的项目。

  • 主应用目标
  • 框架A

FrameworkA 是唯一使用某个 pod 的,因此在我的 pod 文件中我有类似的东西

构建成功没有问题,但是当我在模拟器上运行应用程序时,应用程序立即崩溃并显示以下错误消息:

我尝试了所有常见的嫌疑人(删除派生数据,清理,pod deintegrate ...)到目前为止没有任何效果。

知道为什么会发生这种情况,以及如何在不必在两个目标上安装所有 Pod 的情况下使其工作吗?

该应用程序在 Swift 4.2 中。

0 投票
0 回答
249 浏览

ios - 设备上的退出代码 1

我为我的网站制作了一个 WebView 应用程序。在 Xcode 中应用程序启动得非常好。当我尝试在我的 iPhone Xcode 上启动它时,给我一个错误代码 1。使用 iPhone XS Max Simulator 它运行良好。当我尝试在我自己的 iPhone 上启动该应用程序时,我收到此错误:

错误:失败,退出代码为 1

任何人都可以帮助我吗?

0 投票
1 回答
229 浏览

profiling - Xcode 10.1 分析着色器这可能需要一段时间(永远???)

我正在调试一个 iOS/Metal 应用程序。当按下 GPU 捕获帧按钮(小相机)时,Xcode 会说:“Profiling shaders。这可能需要一段时间......”,但需要永远!这正常吗?我怎样才能解决这个问题?

截屏]

0 投票
1 回答
1870 浏览

ios - 未找到 GStreamer Xcode 10.1 gst/gst.h

Xcode 10.1 中出现未找到 GStreamer gst.h 文件错误。有没有人能够找到它的解决方案???

即使我使用 Objective-C 作为 iOS 项目的主要语言,也会出现此错误。

0 投票
1 回答
688 浏览

xcode - xcode 传递目标名称以运行脚本构建阶段

我正在开发一个 cocoapod(下面屏幕截图中的 MySDK),它在安装过程中运行一个脚本。我需要将主要可执行文件的名称(即SecThree)传递给该脚本,即$FOO如下:

在此处输入图像描述

我以为我可以使用$PRODUCT_NAME,$TARGET_NAME$EXECUTABLE_NAME, 但当然这些是MySDK在 MySDK 目标中运行时。

如何从其依赖项中的脚本中解析主要目标的名称?

0 投票
0 回答
32 浏览

ios - 执行展开转场时不需要的红线

我有一个视图控制器,嵌入在导航控制器中,它有一个按钮,并通过一个按钮将我与另一个视图控制器连接起来。我已经 ctrl 从第二个视图控制器的按钮拖到Storyboard 中的出口,创建了一个unwind segue。虽然unwind segue按需要工作(当我单击按钮时,它会删除当前视图控制器并将我带到第一个视图控制器),但一旦发生这种情况,我的当前视图就会无缘无故地出现一些红线。为什么会这样?与我的 Xcode 安装有关还是与 Xcode 一般有关?我认为的红线

我有 Xcode 10.1,虽然我的代码没有什么花哨的,但无论如何:

0 投票
0 回答
193 浏览

swift - Xcode 9 项目不再使用 Xcode 10.1 编译,抱怨初始化程序。如何进行故障排除?

今天,我升级到 Xcode 10。今天早些时候用我的 Xcode 9.x 编译的同一个项目现在抱怨我在 Xcode 10.1 中几乎所有的初始化程序。

我试过清理项目并重建,没有运气。我玩过编译器优化级别,没有运气。

示例代码: 片段_1

新 Xcode 10 项目中的相同代码编译得很好。编译器错误的其他实例:

0 投票
1 回答
1305 浏览

swift - WKWebView 不能通过键盘交互

一般来说,我是 swift 和苹果开发的新手(来自 JS 世界)。我正在尝试通过包装 WKWebView 来做一个简单的桌面应用程序。ViewController 创建 webView 的部分工作正常。至少看起来是这样:它加载了一个网页:)

但是当我单击任何输入字段时,我无法写任何东西。该字段中甚至没有可见的光标。

基本上只有通过鼠标/触摸板点击才有效。但鼠标光标悬停在元素(例如按钮和文本字段)上时不会改变。在我看来,网页上方有某种蒙版/图层。单击会传播到页面本身,但不会传播到悬停和击键

应用程序中是否有任何特殊的项目设置/权限启用键盘?如何使页面输入可编辑?

更多细节:

  • 单击文本字段有效(它会根据焦点选择器更改边框颜色)
  • 单击<a>webview 作品中的链接
  • 鼠标右键单击似乎有效(它显示复制/粘贴选项等)
  • 通过鼠标右键单击粘贴到现场工作

代码:

我的故事板: 在此处输入图像描述

  • Ww是 WebKit 视图
  • Ww覆盖所有View区域(鼠标拖放)

感谢您的任何回答或提示!

0 投票
1 回答
65 浏览

ios12 - How Do I Hit Test A SubView's Layers?

I have encountered a challenge in my application. I want to be able to tap in a subview and determine which of the subview's layers was tapped. I (naively?) chose to use the hitTest(:CGPoint) method of the subview's root layer. The results were not what I expected. I have created a playground to illustrate the difficulty.

The playground (code below):

  1. Creates a view controller and its root view
  2. Adds a subview to the root view
  3. Adds a sublayer to the subview's root layer

Here is what it looks like:

enter image description here

  1. The root view's root layer is black
  2. The subview's root layer is red
  3. The subview's sublayer is translucent gray
  4. The white line is there for illustrative purposes

With the playground running I start tapping, beginning at the top of the white line and moving down. Here are the print statements produced by the tap gesture handling method:

Root view tapped @(188.5, 12.5)
Hit test returned "Root View -> Root Layer" with frame (0.0, 0.0, 375.0, 668.0)

Root view tapped @(188.5, 49.0)
Hit test returned "Root View -> Root Layer" with frame (0.0, 0.0, 375.0, 668.0)

Root view tapped @(188.5, 88.5)
Hit test returned "Root View -> Root Layer" with frame (0.0, 0.0, 375.0, 668.0)

Sub view tapped @(140.0, 11.0)

Sub view tapped @(138.5, 32.5)

Sub view tapped @(138.5, 55.5)

Sub view tapped @(138.0, 84.0)

Sub view tapped @(139.0, 113.0)
Hit test returned "Sub View -> Root Layer" with frame (50.0, 100.0, 275.0, 468.0)

Sub view tapped @(138.0, 138.5)
Hit test returned "Sub View -> Root Layer" with frame (50.0, 100.0, 275.0, 468.0)

Sub view tapped @(140.0, 171.5)
Hit test returned "Sub View -> Root Layer" with frame (50.0, 100.0, 275.0, 468.0)

Sub view tapped @(137.5, 206.5)
Hit test returned "Sub View -> Sub Layer" with frame (50.0, 100.0, 175.0, 268.0)

Sub view tapped @(135.5, 224.0)
Hit test returned "Sub View -> Sub Layer" with frame (50.0, 100.0, 175.0, 268.0)

You can see that as I tap in the root view things are "normal". As soon as I enter into the subview the hit test no longer finds a layer until I am more than 100 points below the top of the subview; at which point the subview's root layer is encountered. 100 points after that the sublayer of the subview's root layer is encountered.

What is going on? Well, apparently, when the subview was added to the root view, the subview's root layer became a sublayer of the root view's root layer and its frame was altered to reflect its placement in the root view's root layer instead of in the sub view.

So, may questions are:

  1. Am I correct regarding what has apparently happened?
  2. Is it normal and expected?
  3. How do I deal with it?

Thank you for taking the time to consider my question.

Here is the playground code:

Update: Problem Solved

With guidance from the always knowledgeable Matt Nueburg (and his most excellent book), I modified the tap gesture handler method to the following:

Now the console output looks good:

Root view tapped @(186.0, 19.0)
Hit test returned "Root View -> Root Layer" with frame (0.0, 0.0, 375.0, 668.0)

Root view tapped @(187.0, 45.0)
Hit test returned "Root View -> Root Layer" with frame (0.0, 0.0, 375.0, 668.0)

Root view tapped @(187.0, 84.5)
Hit test returned "Root View -> Root Layer" with frame (0.0, 0.0, 375.0, 668.0)

Sub view tapped @(138.0, 9.0)
Hit test returned "Sub View -> Root Layer" with frame (50.0, 100.0, 275.0, 468.0)

Sub view tapped @(137.5, 43.5)
Hit test returned "Sub View -> Root Layer" with frame (50.0, 100.0, 275.0, 468.0)

Sub view tapped @(138.5, 77.5)
Hit test returned "Sub View -> Root Layer" with frame (50.0, 100.0, 275.0, 468.0)

Sub view tapped @(138.0, 111.0)
Hit test returned "Sub View -> Sub Layer 1" with frame (50.0, 100.0, 175.0, 268.0)

Sub view tapped @(138.5, 140.5)
Hit test returned "Sub View -> Sub Layer 1" with frame (50.0, 100.0, 175.0, 268.0)

Sub view tapped @(139.5, 174.5)
Hit test returned "Sub View -> Sub Layer 1" with frame (50.0, 100.0, 175.0, 268.0)

Second Update - Clearer Code

I am circling back with the code that I ended up using to detect touches on sub layers. It is, I hope, more clear than the playground code above.