locoboy
locoboy

Reputation: 38940

UIPasteboard limit

How many custom UIPasteboards can be stored on a single device?I'm curious to know: 1. What the max number of UIPasteboard can be created and what will happen when MAX_NUMBER_OF_PASTEBOARDS is reached and someone tries to add another UIPasteboard to the device.

Upvotes: 4

Views: 1101

Answers (1)

Eitan
Eitan

Reputation: 1348

I conducted a very simple experiment for your question:

NSMutableArray *array = [[NSMutableArray alloc] init];
while (1) {
    [array addObject: [UIPasteboard pasteboardWithUniqueName]];
    if (array.count%100000==0) {
        NSLog(@"%d",array.count);
    }
}

Long story short, it's bounded by the amount of available memory on the device. This means you'll get a didReceiveMemoryWarning and eventually, the application allocating the memory for the clipboard will crash.

Upvotes: 3

Related Questions