开发者

How do I write ALAsset in a NSData

开发者 https://www.devze.com 2023-01-22 16:39 出处:网络
I\'m trying to write ALAsset in a NSData and somehow came up with the following code which does not work. What I would like to know is, whether the code is similar to this? Or is there another way of

I'm trying to write ALAsset in a NSData and somehow came up with the following code which does not work. What I would like to know is, whether the code is similar to this? Or is there another way of doing it?

NSData *data = [[NSData alloc] initWithContentsOfFile:@"assets-library://asset/asset.MOV?   id=10开发者_Python百科0000009&ext=MOV" ];


The defaultRepresentation of an ALAsset has a getBytes:fromOffset:length:error: method. Use that.


There's a space between your "?" and "id=.." is this the problem?

The best way to debug this is to first try opening that file you name (or creating an NSURL and using initWithContentsOfURL as suggested by Max) and then running the debugger, checking whether that succeeds. Right now you're debugging a few things simultaneously, break out that compound statement and figure out what could be going wrong

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号