0

I have a UNNotificationServiceExtension class and from didReceive delegate method I want to read user information from .dat file.

var value : String? = nil

//filePath has valid path with filename

if(filepath != nil){
     value = try? String(contentsOfFile: filepath!)
}

When I print the value it is nil. I even tried to write the value that I need into UserDefaults from the app and tried to read the value from UNNotificationServiceExtension class but it is still nil. I am even unable to read the value from keychain from UNNotificationServiceExtension class.

Any other inputs are appreciated.

Expected result is I should be able to read a file content or read a value from UserDefaults/Keychain in UNNotificationServiceExtension class.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Sanjay
  • 1
  • 1

0 Answers0