1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

iOS: Added memory warning callbacks

This commit is contained in:
Tom Poole 2018-01-26 15:29:26 +00:00
parent 57a75bc990
commit 8c0f0815f0
5 changed files with 52 additions and 15 deletions

View file

@ -188,6 +188,16 @@ public:
const String& sourceFilename,
int lineNumber) = 0;
/** Called by the operating system to indicate that you should reduce your memory
footprint.
You should override this method to free up some memory gracefully, if possible,
otherwise the host may forcibly kill your app.
At the moment this method is only called on iOS.
*/
virtual void memoryWarningReceived() { jassertfalse; }
//==============================================================================
/** Override this method to be informed when the back button is pressed on a device.
This is currently only implemented on Android devices.

View file

@ -116,7 +116,7 @@ private:
addMethod (@selector (mainMenuTrackingEnded:), mainMenuTrackingEnded, "v@:@");
addMethod (@selector (dummyMethod), dummyMethod, "v@:");
#if JUCE_PUSH_NOTIFICATIONS
#if JUCE_PUSH_NOTIFICATIONS
//==============================================================================
addIvar<NSObject<NSApplicationDelegate, NSUserNotificationCenterDelegate>*> ("pushNotificationsDelegate");
@ -125,7 +125,7 @@ private:
addMethod (@selector (application:didRegisterForRemoteNotificationsWithDeviceToken:), registeredForRemoteNotifications, "v@:@@");
addMethod (@selector (application:didFailToRegisterForRemoteNotificationsWithError:), failedToRegisterForRemoteNotifications, "v@:@@");
addMethod (@selector (application:didReceiveRemoteNotification:), didReceiveRemoteNotification, "v@:@@");
#endif
#endif
registerClass();
}
@ -139,7 +139,7 @@ private:
andEventID: kAEGetURL];
}
#if JUCE_PUSH_NOTIFICATIONS
#if JUCE_PUSH_NOTIFICATIONS
static void applicationDidFinishLaunching (id self, SEL, NSNotification* notification)
{
if (notification.userInfo != nil)
@ -150,7 +150,7 @@ private:
didReceiveRemoteNotification (self, nil, [NSApplication sharedApplication], userNotification.userInfo);
}
}
#endif
#endif
static NSApplicationTerminateReply applicationShouldTerminate (id /*self*/, SEL, NSApplication*)
{
@ -241,7 +241,7 @@ private:
return s;
}
#if JUCE_PUSH_NOTIFICATIONS
#if JUCE_PUSH_NOTIFICATIONS
//==============================================================================
static void setPushNotificationsDelegate (id self, SEL, NSObject<NSApplicationDelegate, NSUserNotificationCenterDelegate>* delegate)
{
@ -306,7 +306,7 @@ private:
[invocation invoke];
}
}
#endif
#endif
};
};