Tag: 基础

AVAssetWriter未知错误

我正尝试使用AVAssetWriter从图像创buildvideo。 大部分时间,实现的代码都能正常工作,但是在随机时刻,作者有问题 AVAssetWriter *videoWriter; … [videoWriter finishWriting]; NSLog(@"videoWriter error %@",videoWriter.error); 收到的错误是: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x1f839cd0 {NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x1e59efb0 "The operation couldn't be completed. (OSStatus error -12633.)", NSLocalizedFailureReason=An unknown error occurred (-12633)} 写图片: -(void)writeFrame:(WriteableFrame*)wF { if([writerInput isReadyForMoreMediaData]) { CMTime presentTime = CMTimeMake(wF.frameTime, 1000); CGImageRef tmpImgRef = […]

使用XCode 5的iPhone的Popover视图

我想重新使用这个video中描述的iPhone的popup窗口,这正是我所需要的。 问题是,我不能像在video中一样将UIViewController属性绑定到popup窗口的UIViewController 。 与video的一个不同之处在于它是使用XCode 4.2制作的,我使用的是XCode 5。 所以问题是:如何在XCode 5的video中制作iPhone的popover? 这是我正在努力的XCode 5项目。

如何输出CIFilter到相机视图?

我只是从Objective-C开始,我试图创build一个简单的应用程序,它显示相机视图上的模糊效果。 我得到了相机输出与AVFoundation框架一起工作。 现在,我试图挂钩核心图像框架,但不知道如何,苹果文档是我困惑,search指南和教程在线导致没有结果。 先谢谢您的帮助。 #import "ViewController.h" #import <AVFoundation/AVFoundation.h> @interface ViewController () @property (strong ,nonatomic) CIContext *context; @end @implementation ViewController AVCaptureSession *session; AVCaptureStillImageOutput *stillImageOutput; -(CIContext *)context { if(!_context) { _context = [CIContext contextWithOptions:nil]; } return _context; } – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } […]

AVSpeechSynthesizer错误AudioSession

我正在玩AVSpeechSynthesizer,总是得到这些错误: ERROR: >aqsrv> 65: Exception caught in (null) – error -66634 ERROR: AVAudioSessionUtilities.h:88: GetProperty_DefaultToZero: AudioSessionGetProperty ('disa') failed with error: '?ytp' 我的代码是: AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init]; [synthesizer setDelegate:self]; speechSpeed = AVSpeechUtteranceMinimumSpeechRate; AVSpeechUtterance *synUtt = [[AVSpeechUtterance alloc] initWithString:[[self text] text]]; [synUtt setRate:speechSpeed]; [synUtt setVoice:[AVSpeechSynthesisVoice voiceWithLanguage:languageCode]]; [synthesizer speakUtterance:synUtt]; 有谁知道如何解决这些错误?

:无法识别的select器发送到实例

我正在试图添加“date时间”我的字典定义如下: Symptom Ranking: { 5111ef19253b4a9150000000 = 1; 5111f029253b4add4e000000 = 1; 5111f036253b4a123d000001 = 1; 5111f045253b4a404f000000 = 1; } NSLog(@"date selected: %@", [[self.datePicker date] description]) [self.results setObject:[[self.datePicker date] description] forKey:@"dateTime"]; 应用程序崩溃,我得到这个: Symptom Tracker[43134:c07] -[__NSDictionaryI setObject:forKey:]: unrecognized selector sent to instance 0x7603990 2013-02-06 08:15:58.741 Symptom Tracker[43134:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI setObject:forKey:]: unrecognized […]

如何创build多个本地通知

我试图创build多个本地通知,在我的应用程序,但由于某种原因只有第一通知stream行的起来,其余的只是不工作,这是我的代码。 我有一个名为criaAlertas的类,它负责创build通知,在这个类中我有以下方法: -(void)setarNotificacao:(NSInteger)quando nome:(UILocalNotification *)notification { UIApplication *myapp = [UIApplication sharedApplication]; notification.fireDate = [NSDate dateWithTimeIntervalSinceNow:quando]; notification.alertBody = @"Nice"; notification.timeZone = [NSTimeZone defaultTimeZone]; notification.soundName = UILocalNotificationDefaultSoundName; NSMutableArray *arrayOfNOtifications = [[NSMutableArray alloc]init]; [arrayOfNOtifications addObject:notification]; myapp.scheduledLocalNotifications = arrayOfNOtifications; } 所以我实例化了这个类的一个对象,并试图做到这一点: criaAlertas *novoAlerta = [[criaAlertas alloc]init]; UILocalNotification *notaUm = [[UILocalNotification alloc]init]; UILocalNotification *notaDois = [[UILocalNotification alloc]init]; [novoAlerta setarNotificacao:15 nome:notaUm]; […]

错误域= AVFoundationErrorDomain代码= -11821“无法解码”

尝试将video与AVFoundation合并时,发现了一个奇怪的行为。 我很确定我在某个地方犯了一个错误,但是我太盲目了。 我的目标是合并4个video(稍后会在它们之间交叉淡入淡出)。 每当我试图导出video,我得到这个错误: Error Domain=AVFoundationErrorDomain Code=-11821 "Cannot Decode" UserInfo=0x7fd94073cc30 {NSLocalizedDescription=Cannot Decode, NSLocalizedFailureReason=The media data could not be decoded. It may be damaged.} 最有趣的是,如果我不提供AVAssetExportSession AVMutableVideoComposition,那么一切工作正常! 我不明白我做错了什么。 源video从YouTube上下载并具有.mp4扩展名。 我可以用MPMoviePlayerController播放它们。 在检查源代码的同时,请仔细查看AVMutableVideoComposition。 我在iOS模拟器上testing了Xcode 6.0.1中的这个代码。 #import "VideoStitcher.h" #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> #import <AssetsLibrary/AssetsLibrary.h> @implementation VideoStitcher { VideoStitcherCompletionBlock _completionBlock; AVMutableComposition *_composition; AVMutableVideoComposition *_videoComposition; } – (instancetype)init { self = [super […]

如何在循环内部工作 – 目标C – 基础

我find了这个答案: https://stackoverflow.com/a/5163334/1364174 其中介绍了如何for in循环。 NSFastEnumerationState __enumState = {0}; id __objects[MAX_STACKBUFF_SIZE]; NSUInteger __count; while ((__count = [myArray countByEnumeratingWithState:&__enumState objects:__objects count:MAX_STACKBUFF_SIZE]) > 0) { for (NSUInteger i = 0; i < __count; i++) { id obj = __objects[i]; [obj doSomething]; } } 问题是,我发现它是错的。 首先,当你打开自动引用计数(ARC)时,你得到一个错误 Sending '__strong id *' to parameter of type '__unsafe_unretained_id*' changes retain/release properties of […]

如何在非基于文档的应用程序上集成iCloud?

我已经阅读了苹果文档和Ray Wenderlich的教程。 看来我不得不使用UIDocument,所以我在文档中阅读它。 我发现使用基于文档的方法是有效的。 我的问题是我不想被绑定在特定于平台(iOS)的技术,因此我的应用程序有自己的模型,从头开始只从NSObjectinheritance。 这包括保存/加载。 现在,我需要将iCloud与我的旧模型一起整合。 我将如何以一种优雅/有效的方式来实现我的旧模式实施,并能够整合iCloud?

SEGV_ACCERR在dealloc中调用 removeObserver:self]

我真的不知道这是怎么发生的。 我有一个使用ARC的应用程序。 我的视图控制器大多数注册NSNotifications。 所有注册都在主线程完成。 发生内存警告时,用于每个不可见选项卡的导航控制器都将被清空,并因此被释放。 在这种情况下,一个导航控制器及其视图控制器被释放,并且视图控制器在其dealloc方法中崩溃了应用程序。 具体来说,它是从所有NSNotificationCenter通知中删除自己。 dealloc方法也运行在主线程中,所以我不明白这可能是一个线程问题。 崩溃的行是-[SearchTabViewController dealloc] (SearchTabViewController.m:44) 该代码中的行是: [[NSNotificationCenter defaultCenter] removeObserver:self]; 实际的崩溃原因似乎是objc_msgSend引用一个解除分配的对象。 问题在于只有2个消息在这里发送, NSNotificationCenter类的defaultCenter消息(它永远不会是一个无效的引用,因为它是一个类), removeObserver:消息到默认的中心对象(也永远不会是释放,因为它是一个单身人士)。 唯一被引用的另一个对象是self,它不能被释放,因为我们仍然在这个对象的“dealloc”方法中…基本上这个崩溃不应该发生。 有什么我在这里失踪? 下面的崩溃日志的相关部分: Exception Type: SIGSEGV Exception Codes: SEGV_ACCERR at 0xe0000008 Crashed Thread: 0 Thread 0 Crashed: 0 libobjc.A.dylib 0x000035b0 objc_msgSend + 16 1 Anghami Beta 0x000c7473 -[SearchTabViewController dealloc] (SearchTabViewController.m:44) 2 CoreFoundation 0x00003311 CFRelease + 101 […]