小编kev*_*lar的帖子

如何检测当前正在运行的应用程序是否已从应用商店安装?

在iOS中是否有办法以编程方式检查当前正在运行的应用程序是否已从iOS App Store安装?这与通过Xcode,TestFlight或任何非官方分发源运行的应用程序形成对比.

这是在SDK无法访问应用程序源代码的情况下.

要清楚 - 我正在寻找一些签名,可以这么说,给应用程序(可能是Apple),在不依赖任何预处理程序标志或其他构建配置的情况下,可以在运行时访问任何应用程序.

app-store ios

26
推荐指数
1
解决办法
7364
查看次数

如何在服务器端使用require.js?

我现在使用Backbone.js在客户端上使用它,但我也想将它与node.js一起使用.

javascript node.js backbone.js

19
推荐指数
2
解决办法
1万
查看次数

appendSampleBuffer与音频AVAssetWriterInput"泄漏"内存,直到endSessionAtSourceTime

我有一个奇怪的记忆"泄漏" AVAssetWriterInput appendSampleBuffer.我正在同时写视频和音频,所以我有一个AVAssetWriter有两个输入,一个用于视频,一个用于音频:

self.videoWriter = [[[AVAssetWriter alloc] initWithURL:[self.currentVideo currentVideoClipLocalURL]
                                              fileType:AVFileTypeMPEG4
                                                 error:&error] autorelease];
...
self.videoWriterInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo
                                                           outputSettings:videoSettings];
self.videoWriterInput.expectsMediaDataInRealTime = YES;
[self.videoWriter addInput:self.videoWriterInput];
...
self.audioWriterInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeAudio
                                                           outputSettings:audioSettings];
self.audioWriterInput.expectsMediaDataInRealTime = YES;
[self.videoWriter addInput:self.audioWriterInput];
Run Code Online (Sandbox Code Playgroud)

我开始写作,表面上的一切都很好.视频和音频被写入并对齐等等.但是,我将我的代码放入分配工具并注意到以下内容:

CoreMedia分配

音频字节将保留在内存中,我将在一秒钟内证明.这是内存中的增长.音频字节仅在我调用后才会释放[self.videoWriter endSessionAtSourceTime:...],您会看到内存使用量急剧下降.这是我的音频编写代码,它作为一个块被分派到一个串行队列:

@autoreleasepool
{
    // The objects that will hold the audio data
    CMSampleBufferRef sampleBuffer;
    CMBlockBufferRef  blockBuffer1;
    CMBlockBufferRef  blockBuffer2;

    size_t nbytes = numSamples * asbd_.mBytesPerPacket;

    OSStatus status = noErr;
    status = CMBlockBufferCreateWithMemoryBlock(kCFAllocatorDefault,
                                                data,
                                                nbytes,
                                                kCFAllocatorNull,
                                                NULL,
                                                0,
                                                nbytes,
                                                kCMBlockBufferAssureMemoryNowFlag,
                                                &blockBuffer1); …
Run Code Online (Sandbox Code Playgroud)

memory-leaks objective-c audio-recording ios avassetwriter

18
推荐指数
1
解决办法
3385
查看次数

Heroku Cedar和nginx(gzip)

根据接受的答案中的评论Rails如何Gzip Javascript?(Heroku)和官方雪松文档(http://devcenter.heroku.com/articles/http-routing#the_herokuappcom_http_stack):

由于对Cedar应用程序的请求直接发送到应用程序服务器 - 不通过像nginx这样的HTTP服务器代理 - 因此必须在应用程序中完成任何响应压缩.对于Rack应用程序,可以使用Rack :: Deflater中间件来完成.对于gzip压缩静态资源,请确保在中间件堆栈中的ActionDispatch :: Static之前加载Rack :: Deflater.

但是,据我所知,我的应用程序在herokuapp.com(雪松)上运行,并且根据heroku日志,使用nginx来提供数据(这很棒).我还通过Content-Encoding HTTP标头确认它正在向浏览器gzipping数据.根据文件,这不应该发生在雪松上.我在这里错过了什么吗?

gzip nginx heroku cedar

9
推荐指数
1
解决办法
3723
查看次数

viewDidUnload与viewDidDisappear

我不明白,当我要实现的东西viewDidUnloadviewDidDisappear.这两者有什么区别?

例如,我想NSNotification在视图层次结构中删除视图控制器时发送.在这两种方法之间,我发布通知的位置是否重要?

http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIViewController_Class/Reference/Reference.html

lifecycle view uiviewcontroller ios

6
推荐指数
1
解决办法
3609
查看次数

AmazonS3Client putObject只适用于iOS主线程?

我正在尝试使用AmazonS3Client来放置对象.奇怪的是,它只在我在iOS主线程上运行putObject代码时才起作用.

代码基本上是这样的:

-(void)uploadVideoToS3
{
    S3PutObjectRequest * videoPOR = [[S3PutObjectRequest alloc] initWithKey:video.onlineVideoID inBucket:video.onlineVideoBucketName];
    videoPOR.contentType = @"video/quicktime";
    videoPOR.data        = [NSData dataWithContentsOfURL:video.convertedVideoLocalURL];
    videoPOR.delegate    = self;

    // Put the thumbnail and video into the specified s3 
    AmazonS3Client * s3 = [AmazonClientManager s3];

    [s3 putObject:videoPOR];
    [videoPOR  release];
}
Run Code Online (Sandbox Code Playgroud)

存在桶,我有权限等.如果我只是打电话

[self uploadVideoToS3]
Run Code Online (Sandbox Code Playgroud)

在我的代码中(离开主线程),整个视频上传方法运行(我有一些NSLog来证明这一点),但我从来没有得到任何状态回调,没有抛出异常,并且对象永远不会放入其存储桶在S3上.

当我在主线程上调用上传函数时,如下所示:

dispatch_async(dispatch_get_main_queue(), ^(void) {
                    [self uploadVideoToS3];
                });
Run Code Online (Sandbox Code Playgroud)

我获得进度回调,一切正常,对象成功放入S3存储桶.

有没有人知道putObject是否仅适用于iOS主线程?如果是这样,那将是不幸的,因为它通常是UI线程.

谢谢,凯文

PS我已尝试在非主线程上调度函数调用,但失败的结果相同.

multithreading amazon-s3 ios

6
推荐指数
1
解决办法
2386
查看次数

是否可以列出当前在应用程序中的所有RemoteIO音频单元?

我想将输出渲染回调通过添加AudioUnitAddRenderNotify到当前活动的RemoteIO单元上,该单元将音频输出到扬声器.我无法访问实际的RemoteIO实例变量,但我想在应用程序中获取列表音频单元,并以此方式找到RemoteIO单元.这甚至可能吗?

audio core-audio audiounit ios

5
推荐指数
1
解决办法
442
查看次数

复制SCNParticleSystem似乎不能很好地工作

我正在尝试将SCNParticleSystem用作其他人的"模板".我基本上想要完全相同的属性,除了粒子的颜色动画.这是我到目前为止所得到的:

if let node = self.findNodeWithName(nodeName),
    let copiedParticleSystem: SCNParticleSystem = particleSystemToCopy.copy() as? SCNParticleSystem,
    let colorController = copiedParticleSystem.propertyControllers?[SCNParticleSystem.ParticleProperty.color],
    let animation: CAKeyframeAnimation = colorController.animation as? CAKeyframeAnimation {

    guard animation.values?.count == animationColors.count else {

        return nil
    }

    // Need to copy both the animations and the controllers
    let copiedAnimation: CAKeyframeAnimation = animation.copy() as! CAKeyframeAnimation
    copiedAnimation.values = animationColors

    let copiedController: SCNParticlePropertyController = colorController.copy() as! SCNParticlePropertyController
    copiedController.animation = copiedAnimation

    // Finally set the new copied controller
    copiedParticleSystem.propertyControllers?[SCNParticleSystem.ParticleProperty.color] = copiedController

    // Add the particle system to …
Run Code Online (Sandbox Code Playgroud)

scenekit swift

5
推荐指数
1
解决办法
206
查看次数