Hi, I built my app in iOS 4.1 and the app has iAd Framework. But I want to set deployment target as 3.1 so that app runs perfectly on older iPhone devices as well. To add iAd Banner view, I'm used IB and added the ads to my app. How can I make my app run on older iPhone OS and on Ipads.
You'll have to set the role of the framework to weak, and then make runtime checks in order to handle properly the behavior on different iOS versions.
The MessageComposer sample project does exactly the same - you can view the readme.txt there for more details and source code.
To let your app run on iPhone/iPod and on iPad you need to convert your app to a universal app. For more information check this page.
There is all the information how to create a universal app, make weak links to library's and how to add runtime checks to handle the behavior on different device's.
Btw, iAd came with iOS 4.0, so that will not work on devices that are not running iOS 4.0 or higher. Use the weak link and runtime checks method to disable this for older versions of iOS.
Good luck with your app.