IPHONE 4.3.3 ImageIO:<error> JPEG不是JPEG文件:以0xff 0xd9 </error>开头

时间:2012-10-05 20:34:46

标签: iphone objective-c ios4 wifi decode

我的项目:通过WIFI连接,SOCKET传输。当我收到图片数据时,错误消息:ImageIO: <ERROR> JPEGNot a JPEG file: starts with 0xff 0xd9。

-(void)decodeData:(char*)data length:(int)length {
        struct TVDATA *tvData=(struct TVDATA *)data;
        [jpgData appendBytes:(char*)tvData+8 length:length-8];



        if(tvData->m_frag_totle-1==tvData->m_frag_cur) {
            image = [[UIImage alloc] initWithData:jpgData];

            [self performSelectorOnMainThread:@selector(aa) withObject:nil waitUntilDone:!NO];

            jpgData.length=0;
    }


-(void)aa {
    if(imgView.image!=nil){
        [imgView.image release];
    }
    imgView.image=image;

    [scrollView setDisplayImage:image];

    if (videoflag==1) {
        [self performSelectorOnMainThread:@selector(writeVideo) withObject:nil waitUntilDone:!NO];
    }
}

0 个答案:

没有答案