AVMediaTypeAudio not working in ios 11

I am working on audio merging and it works great on iOS 10 but doesn't work on iOS 11.

How can I access the audio file path in iOS 11?

NSArray *path;
path = [NSArray arrayWithObjects:
        [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, 
         NSUserDomainMask, YES) lastObject],
        [NSString stringWithFormat:@"%@%@",trackName,(i==0) ? 
        (_editRecoding) ? fileExtension : @".mp3" : ([trackName 
        isEqualToString:@"temp"]) ? @".mp3" : @""],
        nil];

AVURLAsset* audioAsset = [[AVURLAsset alloc] initWithURL:[NSURL 
                          fileURLWithPathComponents:path] options:nil];


 NSLog(@"audioAsset : %@", audioAsset);
 NSLog(@"AVMediaTypeAudio : %@", [audioAsset tracksWithMediaType:AVMediaTypeAudio]);

Exit in iOS 10:

 audioAsset : <AVURLAsset: 0x17422b480, URL = file:///var/mobile/Containers/Data/Application/6E092FA1-BE2C-4ECC-897F-3599005F2936/Documents/temp.mp3>

 AVMediaTypeAudio : (
    "<AVAssetTrack: 0x170011fb0, trackID = 1, mediaType = soun>"
)

Exit in iOS 11:

audioAsset : <AVURLAsset: 0x1c4437ba0, URL = file:///var/mobile/Containers/Data/Application/EC64309F-7E09-4DAE-B19C-2A8F160627C3/Documents/temp.mp3>

AVMediaTypeAudio : (
)
+4
source share
1 answer

How can I access the audio track in ios 11?

There is no other method that you already use. According to the documentation of AVMediaType there are no api changes for IOS11.

Decision:

I bet your version of iOS 11 is 11.0.2, so you need to upgrade to 11.0.3, they fixed this sound issue in this version, take a look at the release note.

Apples iOS 11.0.3 hotfix release fixes for two specific issues:

1. , iPhone 7 iPhone 7 Plus.

2. , iPhone 6s, Apple

, , , .

,

11.0.3 update , , .

+1

Source: https://habr.com/ru/post/1688072/


All Articles