- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 UIImagePickerController
让用户选择要在应用程序中共享的照片或视频。当用户在其库中选择媒体项时,我在 UIImagePickerController 的委托(delegate)方法之一中执行此代码:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
PHAsset *asset;
if ([info[@"UIImagePickerControllerMediaType"] isEqualToString:@"public.movie"]) {
// Video
asset = [[PHAsset fetchAssetsWithALAssetURLs:@[info[@"UIImagePickerControllerReferenceURL"]] options:nil] lastObject];
} else if ([info[@"UIImagePickerControllerMediaType"] isEqualToString:@"public.image"]) {
// Photo
PHFetchResult *result = [PHAsset fetchAssetsWithALAssetURLs:@[info[@"UIImagePickerControllerReferenceURL"]] options:nil];
asset = [[PHAsset fetchAssetsWithALAssetURLs:@[info[@"UIImagePickerControllerReferenceURL"]] options:nil] lastObject];
}
}
这两个 if 语句
都适用于照片和视频,除非您从标题为“我的照片流”的相册中选择项目
。
当您从“我的照片流”
中选择项目时,返回的PHAsset
始终为nil
。
我发现以下问题似乎有一个可行的解决方案:ALAssetsLibrary assetForURL: always returning nil for photos in "My Photo Stream" in iOS 8.1
但是上面的链接使用了Apple不再推荐的AssetsLibrary
框架:
"In iOS 8.0 and later, use the Photos framework instead of the Assets Library framework. The Photos framework provides more features and better performance for working with a user’s photo library. See Photos Framework Reference."
我需要能够返回 “我的照片流”
相册中媒体项目的 PHAsset
对象。现在,info
字典中的 UIImagePickerController
返回的引用 URL 是登录控制台的有效 URL,但是当使用此 URL 时,它是一个有效的 PHAsset
对象永远不会返回。
以下是在 didFinishPickingMediaWithInfo:
委托(delegate)方法的信息字典中返回的引用 URL 示例:
assets-library://asset/asset.JPG?id=DCF5C6E5-B4F4-4E61-9C4B-CC63E104BF2B&ext=JPG
最佳答案
这是一个错误,似乎已在最新的 iOS 8.2x 测试版中修复。
关于ios8 - 从 fetchAssetsWithALAssetURLs 返回的 PHAsset : is always nil when choosing a photo from the "My Photo Stream" album using UIImagePickerController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27496888/
我目前很难编译我的新子类: public class CompilationAlbum extends Album { private String seriesOfAlbums; p
我正在使用 android MediaStore。我可以获得设备上的音乐列表,以及与每个媒体项目相关的所有详细信息(标题、艺术家、持续时间等) 我希望能够显示专辑列表,以及他们的专辑艺术家。 需要明确
我有两张 table 表:相册 album_id name parent_album_id ------------------------------------ 69
我想做一个应用程序,在按下按钮时从当前主 UIImageView 保存图像并将其保存到相册。 我的程序所做的是在我按下“保存到相册”按钮后显示错误。可能是我的代码结构不对。或者谁能告诉我正确的代码
我需要一些帮助来制定此查询。我有两个(相关的)表,我将在此处转储它们以供引用: CREATE TABLE IF NOT EXISTS `albums` ( `id` int(11) NOT NUL
如何使用 TagLib 库修改 MP3 文件的“专辑艺术家”字段?有没有类似的东西: f.tag()->setArtist("blabla"); ? 最佳答案 ID3v2 实际上并不支持名为“专辑艺术
在Apple的Photos框架中,有一个PHAssetCollection类,它代表用户库中的相册。 我想获取相册并按上次编辑日期对它们进行排序(例如,上次将照片添加到相册或从相册中删除的日期) -
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visi
我正在学习如何创建模块的 zend 3 教程(他们以相册博客为例)creating a blog 但是我在创建模块时遇到了以下错误; A plugin by the name "Album\Segme
从此继续: Making album-viewer like facebook ,我在那里了解了制作相册查看器的下一个/上一个背后的服务器端, 现在我想知道如何将顶部的地址栏网址从 ?view=1 更
我是 XNA 的初学者。我如何在 XNA 上做简单的带有翻转图像的相册? 最佳答案 您是否有一般的编程经验,或者您对所有编程都不熟悉? 我强烈推荐的一本书是 Aaron Reed 的 Learning
String[] projections = { MediaStore.Audio.Media._ID, MediaStore.Audio.Media.TITLE,
目前我正在通过正常的 ContentResolver 成功查询 MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI,并获得预期的结果。文档说有一个嵌套类 Med
我将 Fusuma 用于我的图像和视频库。我对滚动画廊 View (FSAlbumView.swift) 有疑问。当我滚动时,它会交换视频缩略图,或者代替视频缩略图出现图像缩略图,图像缩略图没有任何问
我正在尝试使用 python 3.7.1 和 mutagen 1.42 从 mp3 文件中获取专辑封面图片的属性(到目前为止只是宽度和高度,但可能稍后会更多),但到目前为止似乎没有任何效果。我还能够正
我希望用户选择一个相册,然后以 react-native 显示其中的照片。有 CameraRoll,它可以按 groupName 进行过滤,但我没有找到检索这些 groupName 的方法。有谁知道如
我正在尝试使用 eyed3 作为 Python 库来更改大量 .MP3 文件的艺术家姓名。我尝试使用项目网页的示例代码 ( http://eyed3.nicfit.net/ ) 和 setsaudio
我无法从 MediaStore 获取 albumID,我从 getColumnIndex 获取 -1。这是我的代码: Cursor cursor = mContext.getContentRe
Facebook iOS SDK 是否像 UIImagePickerController 那样提供任何默认的 (Facebook) 相册照片选择器? 我听说过这个所以搜索了很长时间但找不到任何东西。
有多种命令行工具可用于编辑音频文件的元数据。但是他们都不能编辑音频文件的“专辑艺术家”标签。是否有任何命令行工具或 perl 模块可以执行相同的操作?谢谢 最佳答案 mid3v2 带有 mutagen
我是一名优秀的程序员,十分优秀!