Reputation: 1
I am new to Objective C. I am working on an app which allows users to view certain "groups". Each group in the database has a unique group ID which also has a web presence (the groups can be viewed online).
I want the users to be able to get the URL of the group by tapping a button. Each group URL starts the same way (www.example.com/) but I want to be able to afix the group ID from the database to the end of the URL and copy the entire URL to the iphone clipboard (So users can share the URL with others).
Is there a way to do this? The end result will be www.example.com/(groupid) and copied to the clipboard. If it helps, we are using parse as a backend and we want to copy the group object id.
Upvotes: 0
Views: 837
Reputation: 131
You'll start by making an NSString object containing the data you want on the clipboard.
For you, this will be accomplished as such:
//Get your groupId from wherever it happens to be:
NSString *groupId = @"ThisIsYourGroupID";
//Form the URI by adding it to your host:
NSString *uriText = [NSString stringWithFormat:@"www.example.com/%@",groupId];
//And put it on the .string property of the generalPasteboard:
[UIPasteboard generalPasteboard].string = uriText;
Upvotes: 1