3

Can anyone help me enable a delete button in ABPersonViewController?

bneely
  • 9,083
  • 4
  • 38
  • 46

2 Answers2

2

Take a look at ABPersonViewController+Delete category which does not use any private methods:

https://github.com/shrtlist/ABDelete

Marco
  • 6,692
  • 2
  • 27
  • 38
0

For me this code works:

ABPersonViewController *pvc = [[ABPersonViewController alloc] init];
[pvc setPersonViewDelegate:self];
[pvc setAllowsEditing:YES];
[pvc setAllowsDeletion:YES];
[pvc setAllowsActions:YES];
  • It should be mentioned that his is a hidden method that may cause your app to be rejected from the App Store. Also, you should do a test before using the method (`if (pvc respondsToSelector:@selector(setAllowsDeletion:))`). – David Beck Apr 10 '11 at 15:07
  • it results in compile error because setAllowsDeletion is a private method – user4951 Mar 30 '13 at 16:43
  • I manage to get it working with [picker setValue:[NSNumber numberWithBool:YES] forKey:@"allowsDeletion"];. However, after delete, the windows doesn't pop up. There is no on delete delegate. – user4951 Mar 30 '13 at 17:02
  • @JimThio please post here if you found out how to pop it up – Prakash Desai Aug 02 '13 at 11:01