Tag: iphone

如何构build和编译PJSIP for Xcode,使用示例代码IPJSUA来testing?

如何使用xCode构build和编译PJSIP并运行示例代码IPJSUA?

iOS – 缩放和裁剪CMSampleBufferRef / CVImageBufferRef

我正在使用AVFoundation并从AVCaptureVideoDataOutput获取示例缓冲区,我可以直接写入到videoWriter使用: – (void)writeBufferFrame:(CMSampleBufferRef)sampleBuffer { CMTime lastSampleTime = CMSampleBufferGetPresentationTimeStamp(sampleBuffer); if(self.videoWriter.status != AVAssetWriterStatusWriting) { [self.videoWriter startWriting]; [self.videoWriter startSessionAtSourceTime:lastSampleTime]; } [self.videoWriterInput appendSampleBuffer:sampleBuffer]; } 我现在要做的是在CMSampleBufferRef中裁剪和缩放图像,而不将其转换为UIImage或CGImageRef,因为这会降低性能。

为什么总是返回-1

-(void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; if([recievedData length]) [ recievedData setLength:0 ]; download_size =[response expectedContentLength]; } 我有这个代码。 download_size是NSInteger。 expectedContentLenght始终返回:-1。 也许有人知道为什么? 我试过使用很久,但效果是一样的。 感谢帮助。

我如何使用私人API来阻止iOS应用程序中的传入呼叫?

我希望能够有select地阻止我写的iOS应用程序中的传入呼叫。 这是为个人使用,而不是应用程序商店,所以我很好用私人的API来完成这一点。 我最近遇到了核心电话框架。 有没有办法使用这个框架来阻止呼叫? 如果没有,我可以用什么私人API来做到这一点?

同时AVCaptureVideoDataOutput和AVCaptureMovieFileOutput

我需要能够使AVCaptureVideoDataOutput和AVCaptureMovieFileOutput工作。 下面的代码工作,但是,video录制不。 在调用startRecordingToOutputFileURL之后直接调用didFinishRecordingToOutputFileAtURL委托。 现在,如果我通过简单的注释掉AVCaptureVideoDataOutput从AVCaptureSession删除: [captureSession addOutput:captureDataOutput]; video录制的作品,但没有调用SampleBufferDelegate(我需要)。 我怎么能有AVCaptureVideoDataOutput和AVCaptureMovieFileOutput同时工作。 – (void)initCapture { AVCaptureDeviceInput *captureInput = [AVCaptureDeviceInput deviceInputWithDevice:[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo] error:NULL]; captureDataOutput = [[AVCaptureVideoDataOutput alloc] init]; [captureDataOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()]; m_captureFileOutput = [[AVCaptureMovieFileOutput alloc] init]; NSString* key = (NSString*)kCVPixelBufferPixelFormatTypeKey; NSNumber* value = [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA]; NSDictionary* videoSettings = [NSDictionary dictionaryWithObject:value forKey:key]; [captureDataOutput setVideoSettings:videoSettings]; captureSession = [[AVCaptureSession alloc] init]; [captureSession addInput:captureInput]; […]

iPhone应用程序允许背景音乐继续播放

当声音播放后,立即启动iPhone游戏时,正在播放的背景音乐或播客停止播放。 我注意到其他游戏允许背景audio继续播放。 这怎么可能? 我是否需要重写我的App Delegate中的方法?

从EventStore EventKit iOS获取所有事件

我想知道如何在iOS中使用EventKit从EventStore获取所有事件。 这样我可以指定今天的所有事件: – (NSArray *)fetchEventsForToday { NSDate *startDate = [NSDate date]; // endDate is 1 day = 60*60*24 seconds = 86400 seconds from startDate NSDate *endDate = [NSDate dateWithTimeIntervalSinceNow:86400]; // Create the predicate. Pass it the default calendar. NSArray *calendarArray = [NSArray arrayWithObject:defaultCalendar]; NSPredicate *predicate = [self.eventStore predicateForEventsWithStartDate:startDate endDate:endDate calendars:calendarArray]; // Fetch all events that […]

将UIView围绕由CGMutablePaths组成的形状拖动

我有一个简单的椭圆形(由CGMutablePaths组成),我希望用户能够在其中拖动一个对象。 只是想知道这样做有多复杂,我是否需要知道大量的math和物理学,还是有一些简单的方法可以让我做到这一点? IE浏览器用户在椭圆周围拖动这个对象,并绕过它。

在iPhone应用程序中播放YouTubevideo而不使用UIWebView?

我想从我的iPhone应用程序播放YouTubevideo。 我必须尝试使用​​以下代码在iPhone应用程序中播放YouTubevideo, [self playVideo:@"http://www.youtube.com/watch?v=WL2l_Q1AR_Q" frame:CGRectMake(20, 70, 280, 250)]; – (void)playVideo:(NSString *)urlString frame:(CGRect)frame { NSString *embedHTML = @"\ <html><head>\ <style type=\"text/css\">\ body {\ background-color: transparent;\ color: white;\ }\ </style>\ </head><body style=\"margin:0\">\ <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \ width=\"%0.0f\" height=\"%0.0f\"></embed>\ </body></html>"; NSString *html = [NSString stringWithFormat:embedHTML, urlString, frame.size.width, frame.size.height]; UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame]; [videoView loadHTMLString:html baseURL:nil]; […]

检测iOS应用程序是否在debugging器中运行

我将我的应用程序设置为将debugging输出发送到控制台或日志文件。 现在,我想在代码中决定是否 它在debugging器(或模拟器)中运行,因此有一个控制台窗口,我想直接读取输出或如果 没有控制台窗口,因此,输出应该被redirect到一个文件。 有没有一种方法来确定应用程序是否在debugging器中运行?