小编Boc*_*ica的帖子

React无法在任何根中找到条目文件

我在我的iOS项目中使用React Native作为Pod.当我尝试加载我使用React Native创建的视图时,我得到错误屏幕,将我引用到运行npm的终端窗口.

在终端中,我看到的错误是:错误:无法在任何根中找到条目文件:

我尝试了一些东西,将文件移动到不同的位置,但没有运气.我确实运行了"npm start",我正在寻找" http:// localhost:8081 / "中的文件.该文件的当前位置与我运行"npm start"的位置相同.

我完全被困在这里.我配错了吗 我该怎么从这里排除故障?

ios react-native

24
推荐指数
3
解决办法
2万
查看次数

iOS通用链接与通配符无法正常工作

在我正在开发的iOS应用程序中,我已经设置了Universal Links.该应用程序托管多个域.我使用通配符设置了一些域名.这些域似乎不起作用.例如,我想链接到https://news.mydomain.com/.如果我将以下内容添加到关联域列表中:

applinks:*.mydomain.com - >不起作用

applinks:news.mydomain.com - >工作正常

所以我相信我确实设置正确,apple-app-site-association文件设置正常.我甚至可以在两种情况下(使用Charles Proxy)看到apple-app-site-association文件被检索好了.

对于通配符,链接仅在Safari中打开.

当我在没有通配符的情况下配置域时,应用程序将打开.

我在这里错过了什么吗?我在设备上运行iOS 9.3.2,我正在运行Xcode 7.3.1,它们是今天的最新版本.

ios ios-universal-links associated-domains

23
推荐指数
2
解决办法
5097
查看次数

数据绑定将无法检测"topLevelApplication"的分配

我正在将应用程序从Flex 3迁移到Flex 4.在某些情况下,有一些弹出窗口的宽度和高度绑定到应用程序的宽度和高度.

width="{Application.application.width - 24}" 
height="{Application.application.height - 32}"
Run Code Online (Sandbox Code Playgroud)

Application.application在4.0中已弃用.所以我用它取而代之

width="{FlexGlobals.topLevelApplication.width - 24}" 
height="{FlexGlobals.topLevelApplication.height - 32}"
Run Code Online (Sandbox Code Playgroud)

现在,编译器发出警告,无法检测到topLevelApplication的数据绑定.

数据绑定将无法检测"topLevelApplication"的分配

我的问题是:是否有其他(可绑定)属性,我可以使用它来获得与以前相同的功能?

apache-flex actionscript-3 flex4

11
推荐指数
1
解决办法
1万
查看次数

在Swift委托中保留周期

我有一个UIViewController,其中一个UIToolbar.它们从故事板中实例化.

我为我做了一个自定义课程UIToolbar.根据一些逻辑我做或不显示按钮.

UIViewController当某些按钮被窃听需要采取行动.为此我在中创建了一个委托协议UIToolbar.

目前,当我关闭视图时,它会保留在内存中.进一步调查显示我的代表创建了一个保留周期.

在Objective-C中,我们只需将委托定义为weak.但是,我使用的是Swift,它不允许我将delegate变量定义为weak:

weak var navigationDelegate: MainToolBarDelegate?
// 'weak' cannot be applied to non-class type 'MainToolBarDelegate'
Run Code Online (Sandbox Code Playgroud)

当我关闭视图控制器时,我设置self.toolBar.navigationDelegate = nil并清除内存.但感觉不对劲!

为什么我得到保留周期,为什么我不能简单地将委托定义为weak

delegates ios retain-cycle swift

9
推荐指数
1
解决办法
1981
查看次数

将HTML转换为Attrubuted字符串时,NSAttributedString崩溃

我遇到了try NSAttributedString(data: data, options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType], documentAttributes: nil)使应用程序崩溃的情况。

在控制台中显示: Assertion failure in void _prepareForCAFlush(UIApplication *__strong)()

该函数在中调用extension String。当我在控制台中“ po”值时:

(lldb) po self
<p>Obfuscated string\n</p>


(lldb) po data`
450 bytes
  count : 450
    pointer : 0x00007fd283d75630
    pointerValue : 140542131787312

(lldb) po NSAttributedString(data: data, options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType], documentAttributes: nil)
Obfuscated string
{
            NSColor = "kCGColorSpaceModelRGB 0 0 0 1 ";
            NSFont = "<UICTFont: 0x7fd283c47330> font-family: \"Helvetica\"; font-weight: normal; font-style: normal; font-size: 15.00pt";
            NSKern = 0;
            NSParagraphStyle = "Alignment 4, …
Run Code Online (Sandbox Code Playgroud)

nsattributedstring ios swift

9
推荐指数
1
解决办法
1523
查看次数

从 Safari 共享 PDF 时操作扩展不可用

我们的应用程序操作扩展需要支持所有类型的附件。它几乎适用于任何地方,唯一无法工作的情况是当我尝试共享在 Safari 中打开的 PDF 文件时。例如这个: https: //carlosicaza.com/swiftbooks/SwiftLanguage.pdf

该应用程序甚至没有出现在 Safari 的共享表上,我认为Action Extension 目标NSExtensionActivationRule中一定缺少某些内容。info.plist

这就是NSExtensionActivationRule目前的样子。我尝试了几件事,但到目前为止还没有运气。

    <key>NSExtension</key>
    <dict>
        <key>NSExtensionAttributes</key>
        <dict>
            <key>NSExtensionActivationRule</key>
            <dict>
                <key>NSExtensionActivationSupportsAttachmentsWithMaxCount</key>
                <integer>10</integer>
                <key>NSExtensionActivationSupportsFileWithMaxCount</key>
                <integer>10</integer>
                <key>NSExtensionActivationSupportsImageWithMaxCount</key>
                <integer>10</integer>
                <key>NSExtensionActivationSupportsMovieWithMaxCount</key>
                <integer>10</integer>
                <key>NSExtensionActivationSupportsText</key>
                <true/>
                <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
                <integer>1</integer>
            </dict>
        </dict>
        <key>NSExtensionMainStoryboard</key>
        <string>ShareSheet</string>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.share-services</string>
    </dict>
Run Code Online (Sandbox Code Playgroud)

xcode ios info-plist

6
推荐指数
0
解决办法
467
查看次数

将位置和天气信息添加到 HealthKit 锻炼课程

我正在开发一个应用程序,其中HealthKit使用并HKWorkout创建会话并将其添加到HealthKit商店中。

现在,当我使用 Watch 上的 Apple 原生锻炼应用程序完成户外活动(例如开放水域游泳)后,当我在 iPhone 上的活动应用程序上打开此锻炼时,它会告诉我开始活动的位置和天气当时的条件。

我一直在阅读HealthKit文档,但找不到任何 API 可以将此信息从我的应用程序添加到HKWorkoutSession.

开发人员是否可以将其添加到 中HKWorkout,如果可以:如何添加?

iPhone 上的“活动”应用程序示例

ios swift healthkit watchkit

5
推荐指数
1
解决办法
1899
查看次数

在WatchOS上与Alamofire建立联系

我正在为WatchOS构建应用程序扩展,我想在Watch应用程序中执行一些URL请求.我正在使用Alamofire作为网络部分.

每当我做一个简单的请求时,我在模拟器和真实设备上都会遇到这些错误: load failed with error Error Domain=NSURLErrorDomain Code=-2000 "can’t load from network"

我不清楚为什么会这样.手表与手机配对.使用Charles Proxy我可以看到请求不是通过网络发送的,所以它在发送之前就失败了.

欢迎任何想法.

编辑 这是我的Communications类的工作提取:

import Foundation
import Alamofire

class Communication {
    internal lazy var manager = Communication.getSessionManager()

    typealias SuccesBlock = (DataResponse<Any>?) -> ()
    typealias FailureBlock = (DataResponse<Any>?, Error) -> ()
    typealias ProgressBlock = (Progress) -> ()

    internal static var serverTrustPolicyManager: ServerTrustPolicyManager {
        get {
            return ServerTrustPolicyManager(policies: [:])
        }
    }

    static func getSessionManager(_ serializeRequest:Bool = false) -> Alamofire.SessionManager {
        let manager = Alamofire.SessionManager(configuration: URLSessionConfiguration.default, delegate: Alamofire.SessionManager.default.delegate, serverTrustPolicyManager: …
Run Code Online (Sandbox Code Playgroud)

swift alamofire watchkit

5
推荐指数
1
解决办法
1777
查看次数

JavaScript 中从一个 GPS 位置指向另一个未指向正确方向的箭头

我在互联网和 stackoverflow 上搜索了很多,但不知何故我似乎无法做对!我试图让一个箭头从 1 GPS 方向指向另一个。

我附上了一个测试 HTML,它准确地解释了我的问题。我无法让箭头指向正确的方向,而且我不知道我做错了什么。它计算角度,箭头以该角度旋转,但这不是正确的角度,我没有得到我期望的结果。

任何帮助将非常感激。

地图.png

箭头.png

<!DOCTYPE HTML>
<html>
<head>
    <title>Point to a direction test</title>
    <script>
        function getLocation() {
            var info = document.getElementById("info");
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(calculateArrowRotation);
            }
            else {
                info.innerHTML = "Geolocation is not supported by this browser.";
            }
        }   

        function calculateArrowRotation(location) {
            // Point from here (Arc de Triomph, Paris)
            // var phoneLatitude = 48.873934;
            // var phoneLongitude = 2.2949;

            // Point from here (Gare du Nord, Paris)
            var phoneLatitude = 48.87977;
            var phoneLongitude = …
Run Code Online (Sandbox Code Playgroud)

javascript bearing

3
推荐指数
1
解决办法
2237
查看次数