I’ve been looking to see if anyone had a solution for this but cant find one. I would like to receive the notification that the iOS App is about to go to the background (user has pressed home or launched a URL) and/or that it is about to enter the foreground (so I can implement a pin lock type function!).
These notifications are available in UIApplicationDelegate according to the XCode Docs:
applicationWIillEnterForeground
applicationWillResignActive
Can these event notifications be added with declares (and if so how?) or would this be something which only Xojo can add as ‘official’ app events?
FYI - I had to grab the latest Foundation Library and UIKit declares from your main project to get it to build (I was getting Ptr/UInt32 errors) so you might want to update your example project at some time …
I can send you the one I modified if you wish - won’t post it here now as its obviously your code not mine
I’m glad it worked for you and that you were able to find the working Foundation classes! I’ve been meaning to add it into iOSKit itself for quite some time but I haven’t had the time to do so. That project is very old so it’s not surprising there were errors with the core classes since there was a large round of updates that happened since I posted the project to deal with changes in Xojo.
If you do get a chance to look at the project, you could maybe fix one small thing thing as I got over-excited and tried to use the notifications which were also in there …
You can register for both types of notifications, these methods work perfectly.
Triggering a local notification immediately works.
BUT … when calling the method to register for a notification in 1 minute it bombs immediately in the simulator. On an actual device it bombs about 50% of the time but sometimes works perfectly.
What errors do you see? For me, the example project works exactly as expected and compiles just fine in 2016r3. Maybe you have some missing/duplicated dependencies which need to be corrected.
It is indeed probably interferences with other libraries. It is not your fault. My current project looks like a christmas tree, with plenty of classes and stuff hanging around, to alleviate the incredible number of things missing in Xojo iOS.
If Xojo condescended to satisfy even 10% of feature requests asking for very basic things that have been in Desktop for 25 years, their toyish platform would become decent at last.
I did not really need it for this project. I will save everything as I go, instead of once when the app resigns.
What other libraries are you using? iOSKit and iOSLib should be compatible. The only thing I can think of being a problem would be dtPlugins classes if they expose the same constants/class names. I’m just trying to understand what might be incompatible so it is no longer a problem.
It seemed to be an incompatibility with iOSGestures. So I removed it, and dragged the classes and modules from your project.
At that moment, apparently the regular App object was no longer seen, and errors all concerned properties and constants of my project App object. For instance, such things as
Type "improvediOSApplication" has no member named "Identifier"
Yet, I had not set App’s super as ImprovediOSApplication. When I did, it made no difference.
For the time being, I cannot use iOSImprovedApplication. Sorry.