xcodeで出る「deprecated in iOS 6.」の警告を修正する。

バイスのversionが「iOS 6.0」にした場合、エラーとまではいかないですが、「警告」がいくつか出ます。 おそらく、「iOS6」では利用できないメソッドなり、プロパティがあるために出ているものと考えられます。

2013 3 7 ttgg 5 今回はこの警告の修正をしていきます。

AVAudioSession のdelegate

[c] //警告 "delegate deprecated: first deprecated in iOS 6" [/c]

CCAudioManagerクラスの397行目 init内を以下の用に修正します。 [c] - (id) init: (tAudioManagerMode) mode { if *1 {

    //Initialise the audio session

    //ios6
    [[AVAudioSession sharedInstance] setActive:YES error:nil]; //修正        
    //AVAudioSession* session = [AVAudioSession sharedInstance]; //削除
    //session.delegate = self; //削除

[/c]

[参考サイト]

CCTexture2D

CCTexture2D.m内の変更点。 476行目 [c] //削除 // MUST have the same order declared on ccTypes //NSInteger linebreaks = {UILineBreakModeWordWrap, UILineBreakModeCharacterWrap, UILineBreakModeClip, UILineBreakModeHeadTruncation, UILineBreakModeTailTruncation, UILineBreakModeMiddleTruncation};

//修正 //ios6 NSInteger linebreaks = {NSLineBreakByWordWrapping, NSLineBreakByCharWrapping, NSLineBreakByClipping, NSLineBreakByTruncatingHead, NSLineBreakByTruncatingTail, NSLineBreakByTruncatingMiddle};

[/c]

532行目 [c] //削除 //NSUInteger alignments = { UITextAlignmentLeft, UITextAlignmentCenter, UITextAlignmentRight };

//修正 //ios6 NSUInteger alignments = { NSTextAlignmentLeft, NSTextAlignmentCenter, NSTextAlignmentRight,NSTextAlignmentJustified,NSTextAlignmentNatural}; [/c]

647行目 [c] dim = [string sizeWithFont:font constrainedToSize:boundingSize //lineBreakMode:UILineBreakModeWordWrap];//削除 lineBreakMode:NSLineBreakByWordWrapping];//修正 ios6 [/c]

[参考サイト]

*1:self = [super init]