iOS核心数据与其他用户交换对象
我有一个应用程序,它使用核心数据进行设置,并由stackmob托管。我的用户登录和身份验证非常有效。用户可以创建新用户、登录和注销。问题:现在我想让用户彼此交流。也就是说,如果他们正在参加音乐会,并且想在我的应用程序上邀请其他用户,我将如何设置?我希望它类似于Facebook:当有人发送邀请时,它将显示为收件人的通知。收件人可以点击通知,查看音乐会的详细信息iOS核心数据与其他用户交换对象,ios,networking,core-data,social,Ios,Networking,Core Data,Social,我有一个应用程序,它使用核心数据进行设置,并由stackmob托管。我的用户登录和身份验证非常有效。用户可以创建新用户、登录和注销。问题:现在我想让用户彼此交流。也就是说,如果他们正在参加音乐会,并且想在我的应用程序上邀请其他用户,我将如何设置?我希望它类似于Facebook:当有人发送邀请时,它将显示为收件人的通知。收件人可以点击通知,查看音乐会的详细信息 这个过程叫什么?有没有一个很好的教程可以在iOS上实现这一点?有书吗?在我看来,您必须使用推送通知 您基本上必须将这些添加到您的应用程序委
这个过程叫什么?有没有一个很好的教程可以在iOS上实现这一点?有书吗?在我看来,您必须使用推送通知 您基本上必须将这些添加到您的应用程序委派类中:
- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// other setup tasks here....
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
UILocalNotification *localNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (localNotif) {
NSString *itemName = [localNotif.userInfo objectForKey:ToDoItemKey];
[viewController displayItem:itemName]; // custom method
application.applicationIconBadgeNumber = localNotif.applicationIconBadgeNumber-1;
}
}
// Delegation methods
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {
const void *devTokenBytes = [devToken bytes];
self.registered = YES;
[self sendProviderDeviceToken:devTokenBytes]; // custom method
}
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err {
NSLog(@"Error in registration. Error: %@", err);
}
- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif {
NSString *itemName = [notif.userInfo objectForKey:ToDoItemKey]
[viewController displayItem:itemName]; // custom method
application.applicationIconBadgeNumber = notification.applicationIconBadgeNumber-1;
}
- (void)application:(NSApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
// Code to handle remote notifications
}
来自苹果的完整信息:谢谢。我将浏览导航。