Cant access localstorage for ios10

I am trying to save APN id in localstorage for for my ionic app.It is failing for iOS10. I am using ($window.localStorage.registerPushId = data.registrationId) to set a registration id in local storage, but getting an error that cannot fetch registerPushId of undefined. No localstorage saving operation seems to work for iOS10. However the same code runs for iOS9. Any idea, how I can access the localstorage for iOS10 in my project? Any help will be highly appreciated.