我正试图通过iOS8上的UIActivityViewController打开邮件编辑器.(所以,这个程序没有我自己的代码)设备上的结果是继续错误记录(即使在我关闭邮件并退出到不同的UI控制器之后,消息仍会继续记录)
AX Exchange错误:错误域=可访问性代码= 0"远程服务不响应_accessibilityMachPort"UserInfo = 0x14fd1b60 {NSLocalizedDescription =远程服务不响应_accessibilityMachPort}
在模拟器上,MFMailComposeViewController在我出现错误后立即解散:
viewServiceDidTerminateWithError:Error Domain = _UIViewServiceInterfaceErrorDomain Code = 3"无法完成操作.(_UIViewServiceInterfaceErrorDomain error 3.)"UserInfo = 0x7b6eb4b0 {Message = Service Connection Interrupted}
PS我有xcode 6并在iOS 8.0.2 iPhone 5s上测试.难道我做错了什么?提前感谢您的回复!
我想UIButtons在UIPickerView(在它上面)添加两个.请查看此图片中的Cancel和Done按钮:

我该怎么做?
我正在尝试将自己的图像添加为条形按钮项,但我不知道如何使图像正确缩放.Apple的人机界面指南建议我的图像为44x44像素,但是当我使用44x44像素图像时,它对于工具栏而言太大了,您可以看到:
当我使用较小版本的图像时,它在Retina显示屏上看起来像素化.我该怎么办?
我正在尝试为Swift中的类扩展编写单元测试.类扩展本身将呈现UIAlert具有指定标题和消息,如下所示:
extension UIViewController {
func presentAlert(title: String, message : String) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .Alert)
alertController.addAction(UIAlertAction(title: "Close", style: UIAlertActionStyle.Default, handler: nil))
UIApplication.sharedApplication().keyWindow?.rootViewController?.presentViewController(alertController, animated: true, completion: nil)
}
}
Run Code Online (Sandbox Code Playgroud)
我为我的单元测试创建了一个包含以下代码的文件:
import XCTest
class AlertTest: XCTestCase {
func testAlert() {
let alert = presentAlert("Presented Alert", "This is an Alert!")
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我一直收到错误"Use of unresolved identifier 'presentAlert'".public在咨询了这个SO线程后,我尝试添加到我的扩展中:
public func presentAlert(title: String, message : String)
但仍然没有运气.有人有见识吗?
编辑
基于@hkgumbs的答案,这是我的警报扩展的当前代码:
import Foundation
protocol …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用屏幕上的数据创建 H.264 压缩会话。我创建了一个CGDisplayStreamRef这样的实例:
displayStream = CGDisplayStreamCreateWithDispatchQueue(0, 100, 100, k32BGRAPixelFormat, nil, self.screenCaptureQueue, ^(CGDisplayStreamFrameStatus status, uint64_t displayTime, IOSurfaceRef frameSurface, CGDisplayStreamUpdateRef updateRef) {
//Call encoding session here
});
Run Code Online (Sandbox Code Playgroud)
以下是我目前如何设置编码功能:
- (void) encode:(CMSampleBufferRef )sampleBuffer {
CVImageBufferRef imageBuffer = (CVImageBufferRef)CMSampleBufferGetImageBuffer(sampleBuffer);
CMTime presentationTimeStamp = CMTimeMake(frameID++, 1000);
VTEncodeInfoFlags flags;
OSStatus statusCode = VTCompressionSessionEncodeFrame(EncodingSession,
imageBuffer,
presentationTimeStamp,
kCMTimeInvalid,
NULL, NULL, &flags);
if (statusCode != noErr) {
NSLog(@"H264: VTCompressionSessionEncodeFrame failed with %d", (int)statusCode);
VTCompressionSessionInvalidate(EncodingSession);
CFRelease(EncodingSession);
EncodingSession = NULL;
return;
}
NSLog(@"H264: VTCompressionSessionEncodeFrame Success");
}
Run Code Online (Sandbox Code Playgroud)
我试图了解如何将屏幕上的数据转换为 ,CMSampleBufferRef以便我可以正确调用我的编码功能。到目前为止,我无法确定这是否可行,或者我正在尝试做的事情的正确方法。有没有人有什么建议? …
我已经阅读了在MessageKit 中创建自定义单元格的指南,以及这样的问题
我正在尝试创建一个自定义单元格;这是我的继承自 a 的单元格的代码UICollectionViewCell:
import UIKit
import MessageKit
open class ChatReferenceCell: UICollectionViewCell {
@IBOutlet weak var authorLabel: UILabel!
@IBOutlet weak var referenceText: UITextView!
@IBOutlet weak var participantsLabel: UILabel!
public override init(frame: CGRect) {
super.init(frame: frame)
setupSubviews()
}
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setupSubviews()
}
open func setupSubviews() {
}
open override func layoutSubviews() {
super.layoutSubviews()
}
open func configure(with message: MessageType, at indexPath: IndexPath, and messagesCollectionView: MessagesCollectionView) {
// Do stuff
switch …Run Code Online (Sandbox Code Playgroud) ios uicollectionview uicollectionviewlayout swift messagekit
我对编码很新,所以如果这很愚蠢请温柔:P.
我想通过快速编码实现的是拥有2个视图控制器,可以根据发送segue传递数据.
VC1设置有2个标签和2个按钮.标签1是玩家1的名字,标签2是玩家2的名字.按钮1是从VC2中的全局名称列表中选择播放器1,而按钮2对于播放器2是相同的
VC2有一个选择器视图设置,其中包含一个名称列表和一个"选择"在pickerView中选择的名称的按钮.
我知道如何设置所有按钮,选择器和标签,甚至如何使用prepareForSegue发回数据,但我不知道该怎么做是告诉VC2"选择"按钮将其发送到playerOneSegue或playerTwoSegue基于VC1中选择的按钮.
任何帮助将不胜感激,再次我很抱歉,如果这是愚蠢但我已经卡住了一段时间,并没有找到任何在线帮助.我甚至不确定这是不是我应该这样做的方式.我有一半想要为每个按钮设置一个警报,甚至没有跳到另一个VC,但另一部分想知道如何做到这一点,因为我肯定必须有一种方法大声笑.
以下代码段为iPhone 5和iPhone 6输出不同的值,位置相同.可能是什么原因?
两个不同的iPhone 5输出几乎相同的值,但iPhone 6输出任意值,就像它的引用总是在变化一样.我也试过用另外的iPhone 6+,它与iPhone 6有类似的行为.我错过了一些关于最新iPhone的东西吗?
-(void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading
{
NSLog(@"heading: %lf" , newHeading.magneticHeading);
}
Run Code Online (Sandbox Code Playgroud) 我有一个ARSessionusing aARWorldTrackingConfiguration作为其配置的一部分。我还通过以下方式启用了面部跟踪:
configuration.userFaceTrackingEnabled = true
Run Code Online (Sandbox Code Playgroud)
在func session(_ session: ARSession, didUpdate frame: ARFrame)委托方法中,我可以成功地frame.capturedImage从面向世界的摄像头获取 ,但似乎没有办法从面向世界的摄像头访问框架。
我在这个假设中正确吗?
如果是这样,当同时使用面部和世界跟踪时,是否有其他方法可以访问两个摄像头的帧?
ios ×6
swift ×5
objective-c ×3
iphone ×2
arkit ×1
audio ×1
h.264 ×1
ios8 ×1
iosurface ×1
messagekit ×1
mfmailcomposeviewcontroller ×1
segue ×1
uibutton ×1
uipickerview ×1
unit-testing ×1
xcode ×1
xctest ×1