views:

99

answers:

0

I have a method, that puts something on the pasteboard. This method is called one of two ways, one, as an IBAction from a button, the other from another method which afterwards closes the application by doing:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:"]];

The problem arises only when the application is not closed using the home button, but is closed using the line above. When that happens, the pasteboard contents are lost. I assume this problem has something to do with the object being cleaned up improperly when it closes this way, but have no idea why it is doing that. I have even tried to intentionally leak the object that gets put on the pasteboard, but it still gets lost on the way out.

Here is the method:

- (IBAction) copyLink {
    [[UIPasteboard generalPasteboard] setURL:[NSURL URLWithString:@"here is the url"]];
}