file provider storage iphone not read in device but simulator works fine iOS swift

Problem:

I'm using filemanger to fetch the pdf file and save to document directory.I had tried in simulator it was working fine.In device it was not working.It returns data with nil value.Path will be as like below. 


Solution:

 /private/var/mobile/Containers/Shared/AppGroup/some code/67225671.pdf

After you fetch the pdf from file manager add the line below 

            url.startAccessingSecurityScopedResource()

Then only it will works fine in the device.

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift