Michiel'in solundaki (http://www.tinytimgames.com/2011/09/01/unity-plugins-and-uiapplicationdidfinishlaunchingnotifcation/) yoldaki yolu takip ederek, init yönteminin UIApplicationDidFinishLaunchingNotification anahtarına bir gözlemci ekleyen bir sınıf oluşturabilirsiniz. Gözlemci yöntemi yürütüldüğünde, launchOptions bildirimin userInfo dosyasında yer alacaktır. Ben yerel bildirimleri ile bu yapıyordu bu benim sınıfın uygulanması idi: Uzantımın bağlam başlatıldığında
static BOOL _launchedWithNotification = NO;
static UILocalNotification *_localNotification = nil;
@implementation NotificationChecker
+ (void)load
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(createNotificationChecker:)
name:@"UIApplicationDidFinishLaunchingNotification" object:nil];
}
+ (void)createNotificationChecker:(NSNotification *)notification
{
NSDictionary *launchOptions = [notification userInfo] ;
// This code will be called immediately after application:didFinishLaunchingWithOptions:.
UILocalNotification *localNotification = [launchOptions objectForKey: @"UIApplicationLaunchOptionsLocalNotificationKey"];
if (localNotification)
{
_launchedWithNotification = YES;
_localNotification = localNotification;
}
else
{
_launchedWithNotification = NO;
}
}
+(BOOL) applicationWasLaunchedWithNotification
{
return _launchedWithNotification;
}
+(UILocalNotification*) getLocalNotification
{
return _localNotification;
}
@end
Sonra uygulama bildirimle başlatıldı görmek için NotificationChecker sınıfını kontrol edin.
BOOL appLaunchedWithNotification = [NotificationChecker applicationWasLaunchedWithNotification];
if(appLaunchedWithNotification)
{
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
UILocalNotification *notification = [NotificationChecker getLocalNotification];
NSString *type = [notification.userInfo objectForKey:@"type"];
FREDispatchStatusEventAsync(context, (uint8_t*)[@"notificationSelected" UTF8String], (uint8_t*)[type UTF8String]);
}
Birilerine yardım etmesini umarız!
herhangi bir şans Chon? – Sanniv
Sanırım buna bakmalısın, ben bir zamanım olacak: http://www.tinytimgames.com/2011/09/01/unity-plugins-and-uiapplicationdidfinishlaunchingnotifcation/ – Michiel
Yapman gerekeni eklemeliyim. Bunun çalışması için bir ANE (AIR Native Extension). http://www.adobe.com/devnet/air/native-extensions-for-air.html – Michiel