小编Pet*_*ich的帖子

loadValuesAsynchronouslyForKeys和多个值加载

我想异步加载持续时间,时间(创建视频的时间戳)和资产的区域设置.

Apple显示的所有示例代码'loadValuesAsynchronouslyForKeys:keys'始终只显示一个密钥.即:

NSURL *url = aUrl; 
AVAsset asset = [[AVURLAsset alloc] initWithURL:url options:nil];

NSArray *keys = [NSArray arrayWithObject:@"duration"];
[asset loadValuesAsynchronouslyForKeys:keys completionHandler:^() {

NSError *error = nil;
AVKeyValueStatus durationStatus = [asset statusOfValueForKey:@"duration" error:&error];

switch (durationSatus) {
    case AVKeyValueStatusLoaded:
            // Read duration from asset
            CMTime assetDurationInCMTime = [asset duration];            
        break;

        case AVKeyValueStatusFailed:
            // Report error
        break; 

        case AVKeyValueStatusCancelled:
        // Do whatever is appropriate for cancelation   
    }
}];
Run Code Online (Sandbox Code Playgroud)

我可以假设如果一个项的状态是'AVKeyValueStatusLoaded',那么在完成块中可以同时读取其他值吗?即:

[asset tracks]
[asset commonMetadata];
[asset duration]
Run Code Online (Sandbox Code Playgroud)

iphone objective-c avfoundation ios4

6
推荐指数
2
解决办法
9158
查看次数

xmppframework(iOS)和配置身份验证类型

有没有办法在iOS上为特定的身份验证机制配置xmppframework?

我无法使用http://code.google.com/p/xmppframework上的示例iPhoneXMPP应用程序连接到OpenFire服务器,我知道我的jid,密码和主机名/端口都正确但连接后,我得到了回调:

- (void)xmppStream:(XMPPStream *)sender didNotAuthenticate:(NSXMLElement *)error
Run Code Online (Sandbox Code Playgroud)

带有相应的错误:

RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
Run Code Online (Sandbox Code Playgroud)

在初始握手之后,我收到了委托回调

- (void)xmppStreamDidConnect:(XMPPStream *)sender
{
       if (![[self xmppStream] authenticateWithPassword:password error:&error])
            DDLogError(@"Error authenticating: %@", error);
}
Run Code Online (Sandbox Code Playgroud)

XMPStream类的authenticateWithPassword方法:

- (BOOL)authenticateWithPassword:(NSString *)password error:(NSError **)errPtr
{
...
// Reaches here and we get back a 'YES' because the server reports that one of the 
// supported mechanisms by 'stream:features' is DIGEST-MD5 

if ([self supportsDigestMD5Authentication])
{
   // send the digest data along with with password
}
...
Run Code Online (Sandbox Code Playgroud)

我对此有点新意,所以我可能会问错误的问题.请指出正确的方向.

iphone cocoa-touch objective-c xmppframework

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