---
title: "In Objective-C proper use of Application delegate"  
description: "In Objective-C proper use of Application delegate"  
author: "Anonymous User"  
published: 2015-12-13  
updated: 2015-12-14  
canonical: https://www.mindstick.com/forum/33725/in-objective-c-proper-use-of-application-delegate  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# In Objective-C proper use of Application delegate

I want to call a [web](https://www.mindstick.com/articles/12783/the-ultimate-bunch-of-free-web-design-resources)-[service](https://www.mindstick.com/articles/105963/online-thesis-writing-service-for-college-kids-with-disabilities) to get the [users](https://www.mindstick.com/news/2244/issue-preventing-users-from-accessing-facebook-s-social-networking-platforms-has-been-resolved) information, and after I want to be able to [access](https://www.mindstick.com/articles/12994/how-foreigners-can-access-blocked-websites-in-china) this information from anywhere in our [application](https://www.mindstick.com/articles/12824/calculator-application-in-android) using like this:

```
MyDelegate *delegate = [[UIApplication sharedApplication] delegate];user = delegate.u;
```

Is setting an [instance variable](https://www.mindstick.com/forum/23344/multidimensional-array-of-nsinteger-as-instance-variable) as a [User](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) object in the app [delegate](https://www.mindstick.com/articles/777/delegate-and-event-in-c-sharp) and referencing it from there when needed a poor way of going about it? I typically set it there upon the user's login.

## Replies

### Reply by Tarun Kumar

Normally, you should only connect things to the app delegate if they:\
Were created from the same NIB file as the app delegate (static UI elements in single window interfaces)\
Are associated with application-level event handling that passes through the app delegate (like the menu item for the Preferences Window)\
For everything else, you should create a singleton which manages access to them.

In my programs I normally avoid this, as I think it puts too much responsibility at the top level - I think things should self-manage where possible and that higher level management should only be used when there is a requirement for coordination between peer-level modules.


---

Original Source: https://www.mindstick.com/forum/33725/in-objective-c-proper-use-of-application-delegate

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
