Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 错误:--FigCreateCGImageFromJPEG返回-12910。49152字节_Objective C - Fatal编程技术网

Objective c 错误:--FigCreateCGImageFromJPEG返回-12910。49152字节

Objective c 错误:--FigCreateCGImageFromJPEG返回-12910。49152字节,objective-c,Objective C,当我在设备中运行程序并且程序崩溃时,我得到了上述错误,当它在模拟器中正常工作时,我使用资产库加载图像并在滚动视图中显示。 这是我的密码: - (无效)使用资产{ x=0; y=0; w=320; h=460; void(^assetEnumerator)(ALAsset*,NSUTEGER,BOOL*)=^(ALAsset*结果,NSUTEGER索引,BOOL*停止){ 如果(结果!=NULL){ [应用程序隐藏加载]; [资产添加对象:结果]; NSLog(@“资产计数:%i”,资产计数);

当我在设备中运行程序并且程序崩溃时,我得到了上述错误,当它在模拟器中正常工作时,我使用资产库加载图像并在滚动视图中显示。 这是我的密码:

-

(无效)使用资产{
x=0;
y=0;
w=320;
h=460;
void(^assetEnumerator)(ALAsset*,NSUTEGER,BOOL*)=^(ALAsset*结果,NSUTEGER索引,BOOL*停止){
如果(结果!=NULL){
[应用程序隐藏加载];
[资产添加对象:结果];
NSLog(@“资产计数:%i”,资产计数);
NSString*assetType=[result valueForProperty:ALAssetPropertyType];
if([assetType IsequalString:ALAssetTypePhoto]){
NSLog(“照片资产”);
[自我成功];
}
}
否则{
[应用程序隐藏加载];
NSLog(“资产:结果为零或列表末尾”);
}
};
void(^assetGroupEnumerator)(AlasSetGroup*,BOOL*)=^(AlasSetGroup*组,BOOL*停止){
如果(组!=nil){
[组枚举AssetSungBlock:AssetUmerator];
}
否则{
NSLog(@“GroupEnum:group nil或list末尾..”);
}
[保留资产];
};
AlassetLibrary*library=[[AlassetLibrary alloc]init];
[库枚举组类型:ALAssetsGroupSavedPhotos
usingBlock:assetGroupEnumerator
故障块:^(N错误*错误){
NSLog(@“故障:%@”,错误。说明);
}];
//[图书馆发行];
isvisted=是;
}
-(无效)成功{
dispatch\u async(dispatch\u get\u main\u queue(),^(void){
对于(int i=0;i1)[自卸载前页:第2页];
//加载下一页
[self-loadScrollViewWithPage:((int)scrollOffset.x/320)+1];
}
否则如果(页码>((int)scrollOffset.x/320))
{
//卸下

如果(pagenoAs)当我在处理这个问题时,我找到了解决方案,但是我仍然在iphone中遇到了错误::FigCreateCImageFromJPEG返回了-12914.3031040字节。我们将返回到软件解码。有解决方案来删除这个错误吗?
(void)usingAssets{
    x=0;
    y=0;
    w=320;
    h=460;

   void (^assetEnumerator)( ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop) {

        if(result != NULL) {
             [app hideLoading];



            [assets addObject:result];
            NSLog(@"assets count: %i", assets.count);


            NSString *assetType = [result valueForProperty:ALAssetPropertyType];
            if ([assetType isEqualToString:ALAssetTypePhoto]) {
                NSLog(@"Photo Asset");


                [self success];
            }


        }
        else {
            [app hideLoading];
            NSLog(@"AssetEnum: result nil or end of list");
        }



   };






    void (^assetGroupEnumerator)( ALAssetsGroup *, BOOL *) =  ^(ALAssetsGroup *group, BOOL *stop) {


        if(group != nil) {
            [group enumerateAssetsUsingBlock:assetEnumerator];
        }
        else {
            NSLog(@"GroupEnum: group nil or end of list..");
        }





        [assets retain];



    };


    ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];

    [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos 
                           usingBlock:assetGroupEnumerator
                         failureBlock: ^(NSError *error) {
                             NSLog(@"Failure: %@", error.description);
                         }];
   // [library release];




    isVisited=YES;
}



-(void)success{




    dispatch_async(dispatch_get_main_queue(), ^(void){


        for(int i=0;i<[assets count];i++){
            asset = [assets objectAtIndex:i];
            UIImage *images = [UIImage imageWithCGImage:[[asset defaultRepresentation] fullScreenImage] scale:1.0 orientation:[[asset valueForProperty:@"ALAssetPropertyOrientation"] intValue]];
                       imageview =[[UIImageView alloc]init];

            imageview.frame=CGRectMake(x, y, w, h);

            [imageview setImage:images];

            [scrollview addSubview:imageview];

            x = x  + w ;

        }





    });


}



#pragma mark:----scroll view methods



- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    CGPoint scrollOffset=scrollView.contentOffset;


    ///at any time, it will have only 3 pages loaded- previous, current and next
    if(pageno < ((int)scrollOffset.x/320))
    {
        //unload
        if(pageno>1)[self unloadPreviousPage:pageno-2];

        //load the next page
        [self loadScrollViewWithPage:((int)scrollOffset.x/320)+1];
    }
    else if(pageno > ((int)scrollOffset.x/320))
    {
        //unload
        if(pageno<(kNumberOfPages-2))[self unloadPreviousPage:pageno+2];

        //load back the previous page
        [self loadScrollViewWithPage:((int)scrollOffset.x/320)-1];
    }

    pageno=scrollOffset.x/320;
}

-(void)unloadPreviousPage:(int)index
{



    for(int i=index*4;i<(index+1)*4;i++)
    {
        [[scrollview viewWithTag:i+1] removeFromSuperview];

    }


}







- (void)loadScrollViewWithPage:(int)page {
    if (page < 0)
        return;
    if (page >= kNumberOfPages)
        return;

        pageno=page;
    pgControl.currentPage=pageno-1;

    if(isVisited==NO){
    [NSThread detachNewThreadSelector:@selector(usingAssets) toTarget:self withObject:nil];
        assets = [[NSMutableArray alloc] init];
    for (ALAsset* a in assets){
        NSLog(@"Item in asset");
    }

    }


}