How do I write custom code upon application quit? - objective-c

So im trying to figure out how to run custom code when my application quits. Kind of like how I run awakeFromNib when the program starts to initiate certain items, im looking for the program quit equivilant so I can save the user interface state. Thanks.
Zach
UPDATE: Im not programmin in iOS, im trying to write a mac application.

You're looking for applicationWillTerminate, I think.

Related

How do we run a pharo program without instantiating an object in the playground?

I wrote a Pharo program that generates my daily task non-stop.
The program itself works fine, however I always need to instantiate my object in the playground to run it. Is there some other way of doing it automatically without having to create an object and send a message to it?
Yes, you can. Save the image after you have instantiated your application and closed everything else. Then just start pharo from the image and you will have your application started.
If you want to do it more production wise you could use pharo-launcher.
For more detailed information you could squeak wiki which you can adjust to Pharo.
I would do one of three thing here:
Add an item to the World menu, so you can bring up the menu and select your task. See a Stackoverflow Answer on that same topic.
You could write some triggering code in a .st file on your file system, then use StartupPreferencesLoader to load it on startup.
Create a window morph with a button that, once pressed, runs your code. Open the window, quit and save image changes. Never close the window.

App doesn't launch after adding a method (Xcode 7.2)

I'm new to Cocoa and Mac programming so sorry if this is a bad question,but I got frustrated and I don't know what to do. Heres my ViewController files (Appdelegate.h and .m is left untouched to default)
Up to this point everything works as expected, App compiles and runs without a problem. but when I start adding some logic to a method updateDetailViews I get this:
How to fix it?
You can run your application removing the blue arrow. (Use drag and drop to remove).
It is use to check your function is called or not while your application is running. So when it call your application stop running and show this line. You can run again using the play type button from console.

How to show the NSUserNotification in command-line-tool program?

I want to write a command-line-tool program that only shows the NSUserNotification. I've found out, that in order to show the NSUserNotification I need to create a Cocoa App and is not what I want.
I want to run my program at log-in in background, so that my notification is always visible. How can I do that without creating a Cocoa App?
These are the options I found...
Trick Mac OS X into allowing a notification from a command-line tool.
Trigger the notification using Applescript or a helper application.
Create an Automator workflow & execute it using the automator command.
Automator provides a better experience than Applescript. Didn't try the helper.

Copying a specific file from one path to another

hello everyone im trying to create this tweak that copies a file from one spot to another everytime a specific app opens. Would this be correct to use. im still really new to this, but trying, what command should be placed to have this run everytime the app opens.
- (BOOL)fileManager:(NSFileManager *)fileManager
shouldCopyItemAtPath:(NSString *)srcPath *path/to/where/file/is
toPath:(NSString *)dstPath *where/i/want/it/copied/to
If you want this to run every time the app opens then you can call it from application:didFinishLaunchingWithOptions: in your app delegate.

Create a basic application that will act as a tutorial for how to use another app

I have a very particular application I have developed. I want to create a second app, ideally in visual basic, that provides a tutorial/ guide on how to use my original app step by step.
I imagine PowerPoint slide style images embedded in a simple window with forward & back controls.
I have experience in java, C & VB. Ideally the app needs be be kept simple and written in VB. Can anyone recommend a starting point, or if any tutorials for such exist? I've had a search and nothing stands out.
Thanks.
So, if this essentially just has slides and annotations and forward/backward buttons, why try to write an app for this? (I get that it might be fun to try.) You could simply do screen captures and annotate them and use PowerPoint and create an executable out of that to run.
You can even, I understand, create hyperlinks and such to allow the slide show to progress more like the real app does. I'm no "power point ranger" so I'd point you at the Office docs to learn about that, but I've seen some pretty good tutorials using this method.