How to get errors/warnings in [UIImage initWithData:]

后端 未结 3 920
情歌与酒
情歌与酒 2021-01-21 07:04

i have an MJPEG stream over RTSP/UDP from which i want to generate JPEGs for a UIImageView with [UIImage initWithData:]. Most of the time this works good, but sometimes i get co

3条回答
  •  隐瞒了意图╮
    2021-01-21 07:46

    The initWithData: method should return nil in such cases.

    Try :

    UIImage *myImage = [[UIImage alloc] initWithData:imgData];
    if(!myImage) {
        // problem
    }
    

提交回复
热议问题