我正在尝试将 Xcode 项目迁移到另一台计算机。它给了我警告“警告:无法为签名者构建到自签名根的链”,当它运行时,它立即崩溃,类似于此堆栈溢出中显示的内容:
应用程序在模拟器上运行但不在 iPhone 上运行(dyld`__abort_with_payload dyld`_dyld_start)
我的问题似乎与 Apple Developer Forums 上描述的类似:https : //forums.developer.apple.com/thread/86161
并类似于此堆栈溢出中描述的内容: Xcode ios app development code signature
除了删除证书并重新添加证书的建议外,重新添加我的帐户并重新启动似乎没有帮助。我第二次删除了我的开发者证书,现在我看不到它回来了,而且我不知道如何取回它,因为我的开发者门户似乎没有下载它的地方像以前一样。
我也多次尝试删除派生数据文件夹。
e:我已经确定这台计算机上的任何项目都会导致相同的崩溃和警告。
我已经看了很多,但我似乎只能获得与此问题相关的webView和表格.我的完全不同似乎与同样的崩溃异常:
CALayerInvalidGeometry',原因:'CALayer bounds包含NaN:[0 0; 南楠]
基本上我在这里有一个视图,淡化和缩放图像.我最近决定在UIView动画中使用CGAffineTransformScale更改我的代码,而不是每次计时器滴答时都缩放一个档次.这使用较少的处理能力.
但无论我有什么顺序,它都会在19世纪之后崩溃.它所引用的定位坐标数组似乎不是问题,因为它只有6个长度,并在达到其长度后循环.所以出于某些原因,因为我已经实现了这个动画代码,它让我崩溃了.谁知道为什么?
这是我开始崩溃后改变的部分:
-(void) onTimer{
if(scaleTimer_A==5){
imageView_A.image = [UIImage imageNamed:[attractList_A objectAtIndex:imageIndex_A]];
imageView_A.frame = CGRectMake(300, 200, 3.86, 3.86);
imageView_A.center = CGPointMake(attractLocs_x_A[attractLocs_A_index], attractLocs_y_A[attractLocs_A_index]);
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:2];
imageView_A.alpha = 1;
imageView_A.transform = CGAffineTransformScale(imageView_A.transform, 100, 100);
[UIView commitAnimations];
}
if(scaleTimer_A==10){
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.75];
imageView_A.alpha = 0;
imageView_A.transform = CGAffineTransformScale(imageView_A.transform, 1.2, 1.2);
[UIView commitAnimations];
scaleTimer_A=0;
imageIndex_A+=1;
if(imageIndex_A==imageIndex_A_size){
imageIndex_A=0;
}
attractLocs_A_index+=1;
if(attractLocs_A_index==attractLocs_A_SIZE){
NSLog(@"Back to zero A");
attractLocs_A_index=0;
}
NSLog(@"Image A =%@", [attractList_A objectAtIndex:imageIndex_A]);
}
scaleTimer_A+=1;}
Run Code Online (Sandbox Code Playgroud)
编辑: …
在iOS 5中,我的应用程序使用该方法来改变我的方向:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Run Code Online (Sandbox Code Playgroud)
在iOS 6中我认为我应该这样做,但它什么都不做!我的应用程序旋转不是我想要的方式.
- (BOOL) shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight;
}
Run Code Online (Sandbox Code Playgroud) 我正在使用实时摄像头输出来更新MTKView上的CIImage.我的主要问题是,虽然我遇到的所有设置都是相同的,但是我有一个较大的,负面的性能差异,其中较旧的iPhone获得比较新的iPhone更好的CPU性能.
这是一篇冗长的帖子,但我决定将这些细节包括在内,因为它们可能对这个问题的原因很重要.请告诉我还能包括哪些内容.
下面,我有一个带有两个调试bool的captureOutput函数,我可以在运行时打开和关闭它.我用它来试图确定问题的原因.
applyLiveFilter - bool是否用CIFilter操纵CIImage.
updateMetalView - bool是否更新MTKView的CIImage.
// live output from camera
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection){
/*
Create CIImage from camera.
Here I save a few percent of CPU by using a function
to convert a sampleBuffer to a Metal texture, but
whether I use this or the commented out code
(without captureOutputMTLOptions) does not have
significant impact.
*/
guard let texture:MTLTexture = convertToMTLTexture(sampleBuffer: sampleBuffer) else{
return
}
var cameraImage:CIImage = CIImage(mtlTexture: …
Run Code Online (Sandbox Code Playgroud) 我想将一个Polymer paper-dropdown-menu重置为它在JavaScript中的初始状态,因此没有选择任何内容,所以它看起来像这样:
我可以在纸张下拉菜单中的纸张菜单标签中添加一个ID,然后在JavaScript中访问它并选择它所选择的索引:
document.getElementById("accountTypeMenu").selected = 1;
Run Code Online (Sandbox Code Playgroud)
但是,我只能选择一个可用项目,因此该数字必须为0或更大.我无法将其设置为-1以选择任何内容以在视觉上将其返回到其初始状态,但我可以将所选状态记录到我刚设置的状态.我试图更改为选中的其他值为null和undefined.
这是我用于纸张下拉菜单的html:
<paper-dropdown-menu
id="accountTypeDropdown"
selected-item="{{selectedItem}}"
selected-item-label="{{selected}}"
label='*Account type'
style="width:50%;"
noink
no-animations>
<paper-menu id="accountTypeMenu"
class="dropdown-content"
onmouseup="requiredMenuFieldSelected('accountType')">
<template is="dom-repeat"
items="{{accountTypes}}"
as="accountType">
<paper-item value="[[accountType.id]]">[[accountType.name]]</paper-item>
</template>
</paper-menu>
</paper-dropdown-menu>
<input is="iron-input"
name="accountType"
type="hidden"
value$="[[selectedItem.value]]">
Run Code Online (Sandbox Code Playgroud) 由于我使用画布来呈现键入的文本,并且需要使用其他按键事件,例如退格键、向前删除、制表符和箭头键,因此我需要浏览器之间的兼容性以及使用按键和按键事件。当尝试使用粘贴事件时,keydown 事件优先并取消粘贴事件的发生。
一个相关的问题,但没有解决我的问题,因为我想保留 keydown 和 keypress 事件 keypress 和 keydown 优先于 Firefox 和 Safari 中的粘贴事件
我的事件监听器:
window.addEventListener('paste', pasteText);
window.addEventListener("keypress", keyPressHandler, true);
window.addEventListener("keydown", keyDownHandler, true);
function pasteText (event) {
console.log('paste');
if(selectedLine !== ''){
var clipboardData, pastedData;
event.stopPropagation();
event.preventDefault();
clipboardData = event.clipboardData || window.clipboardData;
pastedData = clipboardData.getData('Text');
}
}
function keyPressHandler(event){
if(selectedLine != '' &&
$(".sp-input").is(":focus") === false &&
$("input").is(":focus") === false){
var key = event.keyCode;
if (key == 13){ // Enter key
gotoNextLineOrDeselect();
}else if (key == 115 && (event.ctrlKey||event.metaKey)|| (key …
Run Code Online (Sandbox Code Playgroud) 这是我之前未回答的问题的扩展:AVCaptureSession is not Recording audio from the mic in Swift
我非常不清楚如何编写实时修改的视频和从麦克风录制的音频。我已经寻找了几个月,但一无所获。似乎使我的问题与其他问题区分开来的是,我在 captureOutput 函数中从sampleBuffer 获取图像缓冲区,将其转换为图像,修改它,然后将其写回 AVAssetWriterInputPixelBufferAdaptor,而不是将输出中的所有内容记录为正常视频。从这里开始,我不知道如何从sampleBuffer获取音频,或者这是否是正确的方法,尽管我已经看到其他人从captureOutput获取AudioBufferList。
至少,这是我在主课上的内容:
class CaptureVC: UIViewController, AVCapturePhotoCaptureDelegate, AVCaptureVideoDataOutputSampleBufferDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate,UIPickerViewDataSource,UIPickerViewDelegate {
var captureSession: AVCaptureSession?
var stillImageOutput: AVCapturePhotoOutput?
var videoPreviewLayer: AVCaptureVideoPreviewLayer?
let videoOutput = AVCaptureVideoDataOutput()
let audioOutput = AVCaptureAudioDataOutput()
var assetWriter: AVAssetWriter?
var assetWriterPixelBufferInput: AVAssetWriterInputPixelBufferAdaptor?
var assetWriterAudioInput: AVAssetWriterInput?
var currentSampleTime: CMTime?
var currentVideoDimensions: CMVideoDimensions?
var videoIsRecording = false
override func viewDidLoad() {
super.viewDidLoad()
let backCamera = AVCaptureDevice.default(for:AVMediaType.video)
let microphone = AVCaptureDevice.default(.builtInMicrophone, for: AVMediaType.audio, position: .unspecified)
var …
Run Code Online (Sandbox Code Playgroud) 我为VS Code安装了Run On Save扩展.我为它做了一个Workspace设置,如果我更改文件然后重新保存,它似乎不会运行."我运行所有文件"未显示在控制台或终端中.
当我选择在我的工作区设置中编辑命令配置时,它会自动编辑文件并注释"将您的设置放在此文件中以覆盖默认设置和用户设置".所以它看起来像这样:
// Place your settings in this file to overwrite default and user settings.
{
"editor.mouseWheelZoom": false,
"emeraldwalk.runonsave": {
"commands": [
{
"match": ".*",
"isAsync": true,
"cmd": "echo 'I run for all files'"
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
我是配置工作区设置的新手,所以我不确定这是否合适.我确保通过在命令选项板上选择它来启用Run On Save.
以下是扩展程序的网站:https://marketplace.visualstudio.com/items?itemName = emeraldwalk.RunOnSave
我正在调用一个函数来尝试打开我设备的闪存:
private func flashOn(device:AVCaptureDevice)
{
print("flashOn called");
do {
try device.lockForConfiguration()
// line below returns warning 'flashMode' was deprecated in iOS 10.0: Use AVCapturePhotoSettings.flashMode instead.
device.flashMode = AVCaptureDevice.FlashMode.auto
device.unlockForConfiguration()
} catch {
// handle error
print("flash on error");
}
}
Run Code Online (Sandbox Code Playgroud)
设置device.flashMode到AVCaptureDevice.FlashMode.auto带来了警告,"'flashMode’在iOS的10.0已被否决:使用AVCapturePhotoSettings.flashMode代替." 虽然它只是一个警告,但它在测试我的应用时不会启用闪存,因此我将该行更改为:
device.flashMode = AVCaptureDevice.FlashMode.auto
Run Code Online (Sandbox Code Playgroud)
所以我设置了这一行,就像它暗示:
AVCapturePhotoSettings.flashMode = AVCaptureDevice.FlashMode.auto
Run Code Online (Sandbox Code Playgroud)
我得到错误"实例成员'flashMode'不能用于类型'AVCapturePhotoSettings'"
所以我不知道如何使用Swift 4.0在Xcode版本9中设置闪存.我在Stack Overflow中找到的所有答案都是针对以前的版本.
现在,在我的相机应用程序中,我可以让用户触摸任意位置来设置焦点和曝光,但是如何才能像苹果的相机应用程序那样获得两全其美的效果呢?
例如,用户可能希望触摸以聚焦在前景中的某物上,但是如果场景发生足够的变化,则应返回continuousAutoFocus。同样,如果用户将相机对准光源,则应更改曝光以使其正确显示,然后,当相机返回场景时,应再次固定曝光,使其不会太暗。但是,他们仍然可以选择使它更亮或更暗,具体取决于他们通过相机视图所触摸的物体。
现在,当视图出现时,我将默认设置设置为屏幕的中心:
func setDefaultFocusAndExposure() {
let focusPoint = CGPoint(x:0.5,y:0.5)
if let device = AVCaptureDevice.default(for:AVMediaType.video) {
do {
try device.lockForConfiguration()
if device.isFocusPointOfInterestSupported {
print(focusPoint)
device.focusPointOfInterest = focusPoint
device.focusMode = AVCaptureDevice.FocusMode.autoFocus
}
if device.isExposurePointOfInterestSupported {
device.exposurePointOfInterest = focusPoint
device.exposureMode = AVCaptureDevice.ExposureMode.autoExpose
}
device.unlockForConfiguration()
} catch {
// Handle errors here
print("There was an error focusing the device's camera")
}
}
}
Run Code Online (Sandbox Code Playgroud)
另外,我让用户根据他们触摸的位置设置焦点和曝光:
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
let bounds = UIScreen.main.bounds
let touchPoint = touches.first! as UITouch …
Run Code Online (Sandbox Code Playgroud) swift ×4
camera ×2
iphone ×2
xcode ×2
animation ×1
canvas ×1
certificate ×1
code-signing ×1
crash ×1
dropdown ×1
exposure ×1
focus ×1
ios ×1
ios6 ×1
ipad ×1
javascript ×1
menu ×1
metal ×1
orientation ×1
paste ×1
performance ×1
polymer-1.0 ×1
reset ×1
root ×1
save ×1
selected ×1
workspace ×1