小编Med*_*ida的帖子

proximityMonitoring可能无法正常工作

对于我的iOS应用程序,我想实现一个功能,当设备面朝下时屏幕应关闭(如接听电话时).所以我开始检测设备方向:

//in my ViewDidLoad
    NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.rotated(_:)), name: UIDeviceOrientationDidChangeNotification, object: nil)

//called when the device changes orientation
    func rotated(notification: NSNotification){
        if UIDevice.currentDevice().orientation == UIDeviceOrientation.FaceDown{
            print("device = faced down")
        }else{
            print("device != faced down")
        }
    }
Run Code Online (Sandbox Code Playgroud)

当设备停机时,我已经打电话了

UIDevice.currentDevice().proximityMonitoringEnabled = true
Run Code Online (Sandbox Code Playgroud)

其他

UIDevice.currentDevice().proximityMonitoringEnabled = false
Run Code Online (Sandbox Code Playgroud)

这个问题UIDeviceOrientationDidChangeNotification似乎有点迟了所以当rotated()调用该功能时,设备已经面朝下了,事实证明,为了 proximityMonitoringEnabled = true关闭屏幕,接近传感器不应该已经被覆盖了!我很确定这是Apple的限制,但也许有人确实找到了解决方案或遇到了解决方法!提前致谢.

ios swift swift2

10
推荐指数
1
解决办法
183
查看次数

Webrtc:无法处理WebRTC答案

我使用ejabberd + stanza io构建实时消息和音频呼叫网站.我设法进行了第一次音频通话

from chrome(on PC) -> chrome(on mac) with no errors
Run Code Online (Sandbox Code Playgroud)

当我尝试拨打电话时会出现问题

from chrome(on mac) to firefox(on pc) or vice versa
Run Code Online (Sandbox Code Playgroud)

Chrome浏览器日志正在显示 Could not process WebRTC answer

通过使用chrome://webrtc-internals调试工具我发现setremotedescription失败的错误:

`Failed to set remote answer sdp: Called with SDP without ice-ufrag and ice-pwd`
Run Code Online (Sandbox Code Playgroud)

这是我用来开始通话的内容:

var session = client.jingle.createMediaSession('full JID');
  session.addStream(localAudio_stream); // getUserMedia stream
  session.start();
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?firefox如何成功建立一个调用但是chrome cant(在opera上测试结果相同(失败))

完整的JS代码

xmpp node.js webrtc jingle stanza.io

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

CallKit CallDirectory 扩展中的错误

我在我的 iOS 项目中实现了 callKit,我使用 callDirectory 扩展来阻止和识别数字,块部分工作正常,唯一的问题是当我尝试添加要识别的数字时:

private func retrievePhoneNumbersToIdentifyAndLabels() -> (phoneNumbers: [String], labels: [String])? {
    // retrieve list of phone numbers to identify, and their labels
    interDefaults?.synchronize()
    if let numbers = interDefaults!.string(forKey: "ident-numbers"){
        if let identities = interDefaults!.string(forKey: "ident-identities"){
            let formattedNumbers = numbers.characters.split{$0 == "*"}.map(String.init)
            let formattedIdent = identities.characters.split{$0 == "*"}.map(String.init)
            return (formattedNumbers, formattedIdent)
        }
    }
    return ([""], [""])

}
Run Code Online (Sandbox Code Playgroud)

当我尝试重新加载扩展时,它失败并显示错误: Error Domain=com.apple.CallKit.error.calldirectorymanager Code=3 "(null)"

通过一些测试,我发现通过用formattedIdent 一个包含 1 个元素 EXP 的数组替换:["Spamm Caller"]扩展工作完美并且没有显示错误,但是当我使用一个包含多个元素的数组时,会出现相同的错误。我做错了什么??提前致谢

swift callkit

5
推荐指数
2
解决办法
2692
查看次数

使用 Electron 选择桌面屏幕区域

我正在尝试编写一个允许用户选择屏幕区域的应用程序(例如选择截屏)。

家中的文件夹

这甚至可能吗?

node.js electron

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

Xcode,没有这样的模块

No such Module每次尝试build/build for testing在 iMac 上执行项目时,我都会收到,但是当我在 Macbook pro 中运行完全相同的项目(项目位于 iCloud 驱动器上)时,一切似乎都运行良好。

两台电脑都在 macOS 高山脉

两个 Xcode 都是 9.0.1

我的播客文件:

platform :ios, '10.0'

target '___' do
        use_frameworks!
        pod 'Socket.IO-Client-Swift', '~> 12.0.0'
        pod 'SkyFloatingLabelTextField'
        pod 'SwAlert'
        pod 'RealmSwift'
        pod 'ESTabBarController-swift'
end
Run Code Online (Sandbox Code Playgroud)

我试过了:

  1. 使用 pod deintegrate 分解项目
  2. 将框架添加到链接的框架和库选项卡
  3. 删除派生数据文件夹
  4. 更新所有豆荚
  5. 将项目移动到机器上的文件夹(不在 icloud 驱动器中)
  6. 删除并重新安装 Xcode
  7. 将搜索路径设置为 $(SRCROOT)

通过进一步调查,我发现派生数据文件夹丢失了我的 pod 的所有 *.framework 文件,因此我从我的 macbook pro(正常工作)复制了派生数据文件夹并将其移动到 imac,这让我感到惊讶似乎已修复No such Module错误,但出现新错误missing required modules: 'SSCZLib', 'SSCommonCrypto'

我该如何解决? PS:我正在使用该.xcworkspace文件

xcode swift

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

标签 统计

swift ×3

node.js ×2

callkit ×1

electron ×1

ios ×1

jingle ×1

stanza.io ×1

swift2 ×1

webrtc ×1

xcode ×1

xmpp ×1