从iOS上的后台返回应用程序

时间:2015-06-11 17:43:29

标签: ios cocoa-touch iphone-privateapi

我有一个在后台成功运行的应用。它还设置并运行了一个工作URL方案。

现在我需要实现以下场景 - 在后台5秒后,我希望应用程序打开本身 - 并使其成为前台场景。

公共方法似乎无法在应用中运行: //Create generic event info EKEvent *event = [EKEvent eventWithEventStore:database]; event.title = @"TEST EVENT"; event.location = @"Test location"; event.notes = @"Example notes"; event.startDate = [NSDate date]; event.endDate = [[NSDate date] dateByAddingTimeInterval:(60 * 60)]; event.calendar = exchange; //Do our super clever hack NSMutableArray *attendees = [NSMutableArray new]; for (int i = 0; i < 5; i++) { //Initialize a EKAttendee object, which is not accessible and inherits from EKParticipant Class className = NSClassFromString(@"EKAttendee"); id attendee = [className new]; //Set the properties of this attendee using setValue:forKey: [attendee setValue:@"Invitee" forKey:@"firstName"]; [attendee setValue:[NSString stringWithFormat:@"#%i", i + 1] forKey:@"lastName"]; [attendee setValue:@"test@email.com" forKey:@"emailAddress"]; //Add this attendee to a list so we can assign it to the event [attendees addObject:attendee]; } //Finally, add the invitees to the event [event setValue:attendees forKey:@"attendees"]; //Save the event! NSError *error = nil; [database saveEvent:event span:EKSpanThisEvent error:&error]; if (error) { NSLog(@"Save failed with error: %@", error); } else { NSLog(@"Success!"); }

是否有任何私有API可以从后台返回应用程序?或者在iOS上根本不可能?

AppStore上的发布

1 个答案:

答案 0 :(得分:2)

答案here包含一个示例项目的链接,该项目可以按其捆绑ID启动应用程序。在您的情况下,您可以为其提供应用程序的捆绑ID,它会将您的应用程序带到前台。您不需要越狱设备即可使用它。