Skip to content

Commit 096f65f

Browse files
authored
Merge pull request svga#81 from yyued/2.5.1-dev
fix iOS 13 beta parser failed.
2 parents 4071c8b + dc2e403 commit 096f65f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Source/SVGAParser.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ - (void)parseWithData:(nonnull NSData *)data
195195
return;
196196
}
197197
NSData *tag = [data subdataWithRange:NSMakeRange(0, 4)];
198-
if (![[tag description] isEqualToString:@"<504b0304>"]) {
198+
NSString *fileTagDes = [tag description];
199+
if (![fileTagDes containsString:@"504b0304"]) {
199200
// Maybe is SVGA 2.0.0
200201
[parseQueue addOperationWithBlock:^{
201202
NSData *inflateData = [self zlibInflate:data];

Source/SVGAVideoEntity.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ - (void)resetImagesWithProtoObject:(SVGAProtoMovieEntity *)protoObject {
140140
if (fileName != nil) {
141141
NSString *filePath = [self.cacheDir stringByAppendingFormat:@"/%@.png", fileName];
142142
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
143-
filePath = [self.cacheDir stringByAppendingFormat:@"/%@", fileName];
143+
filePath = [self.cacheDir stringByAppendingFormat:@"/%@", fileName];
144144
}
145145
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
146146
NSData *imageData = [NSData dataWithContentsOfFile:filePath];
@@ -154,11 +154,11 @@ - (void)resetImagesWithProtoObject:(SVGAProtoMovieEntity *)protoObject {
154154
}
155155
else if ([protoImages[key] isKindOfClass:[NSData class]]) {
156156
NSData *fileTag = [protoImages[key] subdataWithRange:NSMakeRange(0, 4)];
157-
if (![[fileTag description] isEqualToString:@"<89504e47>"]) {
157+
NSString *fileTagDes = [fileTag description];
158+
if (![fileTagDes containsString:@"89504e47"]) {
158159
// mp3
159160
[audiosData setObject:protoImages[key] forKey:key];
160-
}
161-
else {
161+
} else {
162162
UIImage *image = [[UIImage alloc] initWithData:protoImages[key] scale:2.0];
163163
if (image != nil) {
164164
[images setObject:image forKey:key];
@@ -181,7 +181,7 @@ - (void)resetSpritesWithProtoObject:(SVGAProtoMovieEntity *)protoObject {
181181
}];
182182
self.sprites = sprites;
183183
}
184-
184+
185185
- (void)resetAudiosWithProtoObject:(SVGAProtoMovieEntity *)protoObject {
186186
NSMutableArray<SVGAAudioEntity *> *audios = [[NSMutableArray alloc] init];
187187
NSArray *protoAudios = [protoObject.audiosArray copy];

0 commit comments

Comments
 (0)