for(NSDictionary* dict in fishs)
{
AVObject * fish = [AVObject objectWithClassName:@"Fish"];
fish[@"name"] = dict[@"name"];
fish[@"fish_code"] = dict[@"code"];
NSString* path = [[NSBundle mainBundle] pathForResource:fish[@"code"] ofType:@"jpg" inDirectory:@"fish images"];
if(path)
{
AVFile* image = [AVFile fileWithData:[NSData dataWithContentsOfFile:path]];
fish[@"image"] = image;
}
[fish saveInBackground];
}
https://leanticket.cn/t/leancloud/1007