Skip to content
Guest Big Announcement

How to add multiple links to a preference bundle?

Featured Replies

Solved by Rook

It doesn't work. All the buttons open the same link :(

- (void)link {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.iosgods.com"]];
} 
@end

- (void)link2 {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.iosgods.com"]];
} 
@end

- (void)link3 {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.iosgods.com"]];
} 
@end

- (void)link4 {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.iosgods.com"]];
} 
@end

Then add the buttons inside the Preferences.plist and make sure each is different. link,link2,link3,link4 etc.

  • Author

 

- (void)link {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.iosgods.com"]];
} 
@end

- (void)link2 {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.iosgods.com"]];
} 
@end

- (void)link3 {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.iosgods.com"]];
} 
@end

- (void)link4 {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.iosgods.com"]];
} 
@end
 
Then add the buttons inside the Preferences.plist and make sure each is different. link,link2,link3,link4 etc.
I see...

You have to add the @end.

  • Solution

I see...

You have to add the @end.

It's cleaner like this:

- (void)link {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.iosgods.com"]];
}
- (void)link2 {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.iosgods.com"]];
}
- (void)link3 {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.iosgods.com"]];
}
- (void)link4 {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.iosgods.com"]];
}
@end

Create an account or sign in to comment

Featured Content

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.