- [ALAssetsLibrary writeImageToSavedPhotosAlbum:metadata:completionBlock:]未调用完成块

时间:2013-11-04 20:08:18

标签: ios ios7 alassetslibrary

我正在通过-[ALAssetsLibrary writeImageToSavedPhotosAlbum:metadata:completionBlock:]方法保存照片。它的工作原理很大,但对于某些照片,根本没有调用完成回调块。如果保存失败,它至少应该返回到完成块中的NSError对象,但它没有发生......

有人已经遇到过这个问题吗?

编辑:

看起来问题来自照片的元数据。当我将它们设置为nil时,它们会正常保存。文档说You must specify the orientation key in the metadata dictionary to preserve the orientation of the image. 检查后,所有照片的元数据都包含方向键...

仍然应该使用NSError触发完成块。它可以是Apple Bug吗?

编辑2:

对于有兴趣测试的人,这里有一个不起作用的元数据:

{
    ColorModel = RGB;
    DPIHeight = 72;
    DPIWidth = 72;
    Depth = 8;
    Orientation = 1;
    PixelHeight = 2448;
    PixelWidth = 3264;
    "{Exif}" =     {
        ApertureValue = "2.275007124536905";
        BrightnessValue = "-2.881004847950639";
        ColorSpace = 1;
        ComponentsConfiguration =         (
            1,
            2,
            3,
            0
        );
        DateTimeDigitized = "2013:10:15 18:52:49";
        DateTimeOriginal = "2013:10:15 18:52:49";
        ExifVersion =         (
            2,
            2,
            1
        );
        ExposureMode = 0;
        ExposureProgram = 2;
        ExposureTime = "0.06666666666666667";
        FNumber = "2.2";
        Flash = 16;
        FlashPixVersion =         (
            1,
            0
        );
        FocalLenIn35mmFilm = 30;
        FocalLength = "4.12";
        ISOSpeedRatings =         (
            1250
        );
        LensMake = Apple;
        LensModel = "iPhone 5s back camera 4.12mm f/2.2";
        LensSpecification =         (
            "4.12",
            "4.12",
            "2.2",
            "2.2"
        );
        MeteringMode = 5;
        PixelXDimension = 3264;
        PixelYDimension = 2448;
        SceneCaptureType = 0;
        SceneType = 1;
        SensingMethod = 2;
        ShutterSpeedValue = "3.907099697885196";
        SubsecTimeDigitized = 697;
        SubsecTimeOriginal = 697;
        WhiteBalance = 0;
    };
    "{GPS}" =     {
        Altitude = "15.52868632707775";
        AltitudeRef = 0;
        DateStamp = "2013:10:15";
        ImgDirection = "151.5822510822511";
        ImgDirectionRef = T;
        Latitude = "41.90171166666666";
        LatitudeRef = N;
        Longitude = "12.45707";
        LongitudeRef = E;
        TimeStamp = "16:52:48";
    };
    "{MakerApple}" =     {
        1 = 0;
        11 = "7B01259E-B768-4F22-AFE6-D2D33F5D4FC2";
        2 = <a100a600 ae00b600 bc00b500 ab007d00 a100c700 aa00a400 96008800 86007800 9f00a000 9f00a000 a2009200 86007000 7b009400 84008400 72007600 7f008600 7d008300 86008500 80007b00 72007300 68006000 78008000 8c008600 81009300 6f007000 74007200 70007a00 7d007e00 71006e00 7a007800 74008300 af009400 85007a00 72006f00 6b006200 5c008e00 62006000 78009400 92009300 c5009500 a200b700 8d007f00 82006500 6d00ad00 67007c00 79008a00 88008f00 e5009b00 a600c100 79006b00 6e005900 7f00eb00 5e009e00 75008900 8e008f00 4001a800 f6003e01 8a006c00 7d005700 a600d501 5c00c200 7500b900 b4008e00 2c019d00 2c012f01 ba007100 94005500 d0003f02 5600e000 71003001 66019500 1e019000 79007300 85006000 55004500 93002501 48006600 49006e00 c4007900 e7008100 6e006e00 7f005b00 35003600 40003500 28002300 2a003100 30003700 3d004300 4e004b00 48003800 2c002b00 16000800 0f002500 28002d00 2b002900 29002900 28002800 2b002b00 2f001700 15000700 17001400 26003100 31002e00 31002f00 28002800 28002800 28001800 11000700 21002900 2b002b00 29002c00 2e002e00 26002400 25002500 25001800 0d000700 20002700 27002700 29002a00 2b002b00 24002400 25002200 22002100 22001600 21002400 23002400 26002600 28002700>;
        3 =         {
            epoch = 0;
            flags = 1;
            timescale = 1000000000;


          value = 108598355094541;
        };
        4 = 1;
        5 = 101;
        6 = 104;
        7 = 0;
    };
    "{TIFF}" =     {
        DateTime = "2013:10:15 18:52:49";
        Make = Apple;
        Model = "iPhone 5s";
        Orientation = 1;
        ResolutionUnit = 2;
        Software = "7.0.2";
        XResolution = 72;
        YResolution = 72;
    };
} 

1 个答案:

答案 0 :(得分:2)

删除“2”中的{MakerApple}对象。此选项可防止保护。