2011-04-29 6 views
0

iAd가 iOS 3.2에서 충돌을 일으키고 있음을 알았습니다. 빌드 설정에서 연결이 약합니다. 내 createAdBanner 메서드에서 충돌이 발생합니다.iAd 3.2에서 충돌 발생

NSString *contentSize; 

if (&ADBannerContentSizeIdentifierPortrait != nil) { 
    contentSize = UIInterfaceOrientationIsPortrait(self.interfaceOrientation) ? ADBannerContentSizeIdentifierPortrait : ADBannerContentSizeIdentifierLandscape; 
} 
else { 
    contentSize = UIInterfaceOrientationIsPortrait(self.interfaceOrientation) ? ADBannerContentSizeIdentifier320x50 : ADBannerContentSizeIdentifier480x32; 
} 

여기에 오류가 있습니다.

This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all 
     Attaching to process 4681. 
     Assertion failed: (cls), function getName, file /SourceCache/objc4_Sim/objc4-427.1.1/runtime/objc-runtime-new.m, line 3939. 
     Assertion failed: (cls), function getName, file /SourceCache/objc4_Sim/objc4-427.1.1/runtime/objc-runtime-new.m, line 3939. 
     Current language: auto; currently objective-c 
     (gdb) 

약점을 연결하면 3.2에서 iAds를 실행할 수 있다고 생각했습니다. 어떤 아이디어 나 제안?

답변

1

weak link 이외에도 장치에서 광고 클래스를 사용할 수 있는지 확인해야합니다. 이렇게하려면, 당신은 클래스의 존재 여부를 테스트하려면 다음을 사용할 수 있습니다

Class adClass = NSClassFromString(@"AdBannerView"); 

if(adClass){ 
    //ads are available so optionally show them 
}else{ 
    // ads are not available 
} 

특정 방법을 확인하려면, 당신은이를 사용합니다 :

BOOL methodExists = [someObject respondsToSelector:@selector(selectorToTestName:)]; 

if(methodExists){ 
    //Safe to call selector 
}else{ 
    //The selector doesn't exist in this version of iOS. 
} 

또한 바로 사용할 수있는 문 위, 부울 체크 "인라인"더 명확하게주고 아래 링크

if([someObject respondsToSelector:@selector(selectorToTestName:)]){ 
    //Safe to call selector 
}else{ 
    //The selector doesn't exist in this version of iOS. 
} 
+0

viewdidload에서이 오류를 처리 할 수 ​​있습니까? 특히 클래스 adClass = ... 어디에 넣어해야합니다. – Vikings

+0

@ Vikings1201 - 어떤 오류가 발생 했습니까? 이 코드는'viewDidLoad'에서 작동합니다. – Moshe

+0

그래, 오류가 수정되었지만 광고가있을 수 있다면 명세서의 if 부분에 절대로 들어 가지 않습니다. 따라서 광고는 표시되지 않습니다. – Vikings

3

http://developer.apple.com/library/ios/#documentation/userexperience/Reference/ADBannerView_Ref/Reference/Reference.html

ADBannerView는 4.0 이상에서 사용할 수 있습니다.

당신은 위의 4.0에서 사용할 수 ADBannerViewcan 3.2

+0

그래서 불가능합니다. – Vikings

+0

아니야! 당신은 약 3.2 절에서 프레임 워크와 코드를 링크해야합니다. –

+0

@ Vikings1201 - 약한 링크가있는 프레임 워크를 코딩하는 방법에 대한 저의 답을보십시오. – Moshe

0

에 광고를 게재 할 수 없습니다. Apple 설명서를 참조하십시오.

0

사용을 심지어는 linkingFlags은 느릅 나무에 _weak_framework 말게을 가져가 3.0 이상 IAD Tutorial IOS에서 사용하는 링크를 통해 이동하십시오.