自从我在iOS 10模拟器上构建并开始运行应用程序以来,我开始获取日志,例如:
objc[6880]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x120275910) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x12009f210). One of the two will be used. Which one is undefined.
2016-09-14 17:18:55.812525 MyApp[6880:340725] bundleid: com.MyApps.MyApp, enable_level: 0, persist_level: 0, propagate_with_activity: 0
2016-09-14 17:18:55.813154 MyApp[6880:340725] subsystem: com.apple.siri, category: Intents, enable_level: 1, persist_level: 1, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-09-14 17:18:55.842900 MyApp[6880:340837] subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, …Run Code Online (Sandbox Code Playgroud) 我在 Mac 上安装了 Python 3 并安装了一些软件包。但后来我看到 AWS lamda 不支持 Python 3,所以我决定降级。我删除了应用程序中的 Python3 文件夹并清除了垃圾箱。但我仍然在/Library/Frameworks/Python.framework/Versions中看到一个名为 3 的文件夹,它导致了问题,如下所示:
$ python3 -m pip install virtualenv
Requirement already satisfied: virtualenv in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (20.14.1)
Requirement already satisfied: platformdirs<3,>=2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from virtualenv) (2.5.2)
Run Code Online (Sandbox Code Playgroud)
所以我的问题是如何从我的 Mac 上完全卸载 python 3?
我试图理解此崩溃报告,但无法理解,因为函数“applySettings()”不是从 init() 调用的,如崩溃报告中所示。Swift 中的“部分申请closure#1”是什么?
这是 init() 函数所需的代码。
public override init()
{
super.init()
discoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [AVCaptureDevice.DeviceType.builtInWideAngleCamera, AVCaptureDevice.DeviceType.builtInDualCamera, AVCaptureDevice.DeviceType.builtInTelephotoCamera, AVCaptureDevice.DeviceType.builtInDualWideCamera,
AVCaptureDevice.DeviceType.builtInTripleCamera,
AVCaptureDevice.DeviceType.builtInUltraWideCamera], mediaType: AVMediaType.video, position: .unspecified)
detectLenses()
checkForDeviceAuthorization()
setZoomParams()
sessionQueue.async { [unowned self] in
self.configureSession()
}
}
Run Code Online (Sandbox Code Playgroud) 迁移到Swift 4.2后,我遇到了多个错误,其中一个很奇怪.这似乎是Xcode 10中的一个错误,但有没有可用的解决方法?
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playAndRecord, with: options)
} catch {
NSLog("Could not set audio session category")
}
Run Code Online (Sandbox Code Playgroud)
****'setCategory(_:with :)'在Swift中不可用
RemoteIO设备有没有办法在iPhone 5上拿回麦克风?我可以配置AVAudioSession在前置麦克风或底部麦克风之间进行选择,但我找不到选择后置麦克风的方法.
在AVFoundation framework确定了使用视频录制的背部麦克风使用后置摄像头的时候,但我希望的方式来选择使用相同的CoreAudio的.那可能吗 ?
根据Swift 3文档,NSNumber被桥接到Swift本机类型,如Int,Float,Double,......但是当我尝试在Dictionary中使用本机类型时,我得到了使用NSNumber修复的编译错误,为什么会这样?这是我的代码:
var dictionary:[String : AnyObject] = [:]
dictionary["key"] = Float(1000)
Run Code Online (Sandbox Code Playgroud)
并且编译器给出错误"无法将类型Float的值赋给AnyObject".如果我按如下方式编写代码,则没有问题,因为NSNumber实际上是一个对象类型.
dictionary["key"] = NSNumber(value:Float(1000))
Run Code Online (Sandbox Code Playgroud)
Swift编译器还提示将代码更正为
dictionary["key"] = Float(1000) as AnyObject
Run Code Online (Sandbox Code Playgroud)
但我不确定这是否正确.如果确实在NSNumber和本机类型(Int,Float等)之间存在桥接,为什么编译器强制转换为AnyObject?
升级到iOS 12和XCode 10之后我有以下内容:
2018-09-20 11:58:09.622656+0400 MyApp-Swift[1027:137400] [avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port Speaker (type: Speaker)
Run Code Online (Sandbox Code Playgroud)
知道它是什么,它是应用程序中的错误还是iOS 12中的已知问题?
iOS 13 / 13.1自动旋转的行为似乎与iOS 12不同。例如,我的应用程序允许用户在设置中将界面方向锁定为纵向或横向模式。
如果我在设备上设置了纵向旋转锁定并在supportedInterfaceOrientations中返回了.landscape,则该界面将保持纵向模式,直到我在设备上禁用了纵向锁定方向。iOS 12似乎并非如此。事实上,iOS 13中甚至没有调用supportedInterfaceOrientations!
在这种情况下,UIViewController.attemptRotationToDeviceOrientation()也不起作用。
问题的根源是我在应用初始化时以及在初始化所有内容时暂时将shouldAutorotate返回为false,我调用UIViewController.attemptRotationToDeviceOrientation()触发自动旋转。它在iOS 12中触发自动旋转,但在iOS 13.1中不起作用。
看起来像是iOS 13.1中的错误。我该如何强制触发自动旋转?
编辑:看起来iOS 12.4.1也忽略了UIViewController.attemptRotationToDeviceOrientation()。iOS 12.4.1及更高版本中的自动旋转功能有问题。
要清楚,这就是我想要的:
一种。即使在iPhone上设置了人像锁,我也希望我的界面在需要时能够自动旋转到横向模式,
b。UIViewController.attemptRotationToDeviceOrientation()替代方案,在所有情况下都会触发自动旋转。
我没有在我的项目中使用Size类,并继续使用旧方法进行视图控制器方向.我收到了弃用警告,例如当我使用下面的代码时:
if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {
...
}
Run Code Online (Sandbox Code Playgroud)
我搜索了很多但找不到合适的方法来修复它.有什么建议 ?
swift ×5
ios ×4
xcode ×4
autorotate ×2
avfoundation ×2
swift4.2 ×2
xcode10 ×2
audiounit ×1
autolayout ×1
core-audio ×1
ios10 ×1
ios12 ×1
ios8 ×1
iphone ×1
macos ×1
nsnumber ×1
python ×1
python-3.x ×1
remoteio ×1
swift3 ×1
swiftui ×1
terminal ×1
uikit ×1
xcode8 ×1