2 Replies
      Latest reply on Aug 20, 2015 6:01 AM by elementarteilchen
      karen Level 1 Level 1 (0 points)

        Hello all,

         

        It seems that in iOS 9/Xcode 7 beta 5, I am unable to access

        [UIPasteboard generalPasteboard] string];
        
        

        from my Today widget extension as every time no matter the contents, it returns (NULL). I looked through the release notes and I did not see anything regarding this.

         

        Any ideas?

        • Re: UIPasteboard returning null from Today extension
          jorge Level 1 Level 1 (0 points)

          My app, which is a password manager, needs to check the pasteboard's contents while in background to clear it after a while, so as to limit the users's password exposure.

           

          The main app, while on background, is also getting nil from the

          [[UIPasteboard generalPasteboard] string]
          

          call. When it comes back to the foreground, it gets the correct data.

           

          Because of that, I suspect this is a new and undocumented security/privacy feature and that there will be no "fixing".

           

          Can someone (Apple) confirm that?

            • Re: UIPasteboard returning null from Today extension
              elementarteilchen Level 2 Level 2 (25 points)

              I also think that this is one of the new privacy/security features of iOS 9. In general I think it is a good idea to prevent that Apps in the background can no longer inspect the pasteboard. A user who needs to paste a password fom one app to the other does not want that other Apps in the background can see this password.

               

              But there's one problem with the current implementation in iOS 9: The pasteboard is even blocked before the App is actually in the background. Even in the "applicationWillResignActive:" delegate of  UIApplication the pasteboard already returns nil. This makes it difficult for Apps to do last-minute stuff with the pasteboard before they are going to the background.