From the course: iOS Development: Security

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using an app-specific pasteboard

Using an app-specific pasteboard - iOS Tutorial

From the course: iOS Development: Security

Start my 1-month free trial

Using an app-specific pasteboard

- [Instructor] Another approach to prevent pasteboard data leakage is to use an app-specific pasteboard. This prevents sharing our application's sensitive data and it also gives us more control over what gets copied and pasted. Again, we start with the original Pasteboard project. If you want to follow along with me, you can find the project in the Exercise folder, Chapter 2, 02_08, begin. So let's switch to the AppDelegates source file. We create a custom pasteboard instance. I declare it as a static property. It's a variable and let's call it customPasteboard. To create a custom pasteboard I use the UIPasteboard initializer. The initializer requires a name of type UIPasteboardName, which can be initialized using a raw value that identifies the pasteboard. Raw value, and let's give it an identifier how about, CustomPasteboard. The create parameter is a Boolean value that indicates whether the pasteboard should be created if it doesn't exist already. I set it to true because we want…

Contents