The advertisement required to be loaded for iPhone OS 4 is IAD. In the previous iPhone operating systems, IAD ads were not supported. Therefore, we need to load admobview ads. Therefore, we cannot load IAD through the XIB file. However, there is no problem. We can load the advertisement as follows:
Class myclass = nsclassfromstring (@ "adbannerview ");
If (myclass! = Nil ){
Cgfloat rate = [[uiapplication sharedapplication] keywindow]. Frame. Size. width/640.0;
Adbannerview * adview = [[adbannerview alloc] initwithframe: cgrectmake (0, 88 * rate, 640 * rate, 100 * rate)];
Adview. tag= 1101;
Adview. Delegate = (ID) self;
[Self. View addsubview: adview];
[Adview release];
} Else {
Admobad = [admobview requestadwithdelegate: Self];
[Admobad retain];
}
You can load the advertisement through the above method.
However, there is another problem, that is, the IAD import of library files. We must change the link mode to the weak link mode. Otherwise, the program cannot run on the system before the iPhone OS 4.