Discussion Forums  >  Xcode, Errors, Installing, Configuring

Replies: 10    Views: 355

Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
01/01/14 05:01 PM (10 years ago)

Fixed -- warnings for iOS 6 in Xcode

I downloaded an empty project for Buzztouch v3. All free plugins and all my purchased plugins were included in the prepared project. Then I set the Deployment Target for 6.1 - Click on tiny folder icon (under the big play button on upper-left) - Click on blue project icon - Click on General table in main window - Within Deployment Info section, find the Deployment Target setting - Use the pull-down to select 6.1 for iOS 6.1 and later After compiling the empty project, there were a lot of warnings in the core of Buzztouch and in the plugins. Here is how I fixed all the deprecations (items that will be removed by Apple in the future). -- Niraj
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
01/01/14 05:01 PM (10 years ago)
TARGET = iOS 6.1 ====================== --- OLD --- if(adBannerView != nil){ //we may need to change the banner ad layout if(UIInterfaceOrientationIsLandscape([UIDevice currentDevice].orientation)) { [adBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierLandscape]; }else{ [adBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierPortrait]; } --- NEW --- if(adBannerView != nil){ //we may need to change the banner ad layout [adBannerView setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; --------------------------- --- OLD --- if([subView_2 respondsToSelector:selector]){ if(UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) { [theAdView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierLandscape]; }else{ [theAdView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierPortrait]; } } --- NEW --- if([subView_2 respondsToSelector:selector]){ [theAdView setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; } --------------------------- --- OLD --- [self.adBannerView setTag:955]; if(UIInterfaceOrientationIsLandscape([UIDevice currentDevice].orientation)) { [adBannerView setCurrentContentSizeIdentifier: ADBannerContentSizeIdentifierLandscape]; }else{ [adBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierPortrait]; } --- NEW --- [self.adBannerView setTag:955]; [adBannerView setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; --------------------------- --- OLD --- [self.navigationController presentModalViewController:moviePlayerController animated:YES]; --- NEW --- [self.navigationController presentViewController:moviePlayerController animated:YES completion:nil]; --------------------------- --- OLD --- [theViewController.navigationController presentModalViewController:picker animated:YES]; --- NEW --- [theViewController.navigationController presentViewController:picker animated:YES completion:nil]; --------------------------- --- OLD --- [self dismissModalViewControllerAnimated:YES]; --- NEW --- [self dismissViewControllerAnimated:YES completion:nil]; --------------------------- --- OLD --- loadingLabel.textAlignment = UITextAlignmentCenter; --- NEW --- loadingLabel.textAlignment = NSTextAlignmentCenter; --------------------------- --- OLD --- audioDurationLabel.textAlignment = UITextAlignmentRight; --- NEW --- audioDurationLabel.textAlignment = NSTextAlignmentRight; --------------------------- --- OLD --- audioTimerLabel.textAlignment = UITextAlignmentLeft; --- NEW --- audioTimerLabel.textAlignment = NSTextAlignmentLeft; --------------------------- --- OLD --- volumeHighLabel.textAlignment = UITextAlignmentRight; --- NEW --- volumeHighLabel.textAlignment = NSTextAlignmentRight; --------------------------- --- OLD --- volumeLowLabel.textAlignment = UITextAlignmentLeft; --- NEW --- volumeLowLabel.textAlignment = NSTextAlignmentLeft; --------------------------- --- OLD --- audioStatusLabel.textAlignment = UITextAlignmentCenter; --- NEW --- audioStatusLabel.textAlignment = NSTextAlignmentCenter; --------------------------- --- OLD --- titleLabel.lineBreakMode = UILineBreakModeTailTruncation; --- NEW --- titleLabel.lineBreakMode = NSLineBreakByTruncatingTail; ---------------------------
 
EdReyes
Lost but trying
Profile
Posts: 574
Reg: Oct 21, 2013
location unknow...
17,640
like
01/01/14 05:19 PM (10 years ago)
Thanks for the fix
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
01/01/14 05:25 PM (10 years ago)
is there a way to put this in an applescript or something that we can run and it automatically do the updates? :)
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
01/01/14 05:35 PM (10 years ago)
There is another way to fix the iAds warnings, use option #1 in this article. http://www.touch-code-magazine.com/iad-code-is-broken-in-ios6/ easy temporary solution – you can quickly get your app to compile again by using a cheap cheat, add explicitly #import <iAd/iAd.h> to the files where you are accessing currentContentSizeIdentifier and the size name constants. That should get you going until you alter your app to use the new auto-layout features. ------------- In general, if one wants to keep using the old deprecated code along with the new replacement code, then the use of conditional compiler statements (#ifdef) can help to avoid warnings for older iOS and for newer iOS: #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7 //pre iOS 7, which means iOS 4.x, 5.x, 6.x #else //post iOS 7 #endif -- Niraj
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
01/01/14 05:39 PM (10 years ago)
OMG Uelsimon, AppleScript ?! I find myself spending hours for a simple AppleScript. Usually, I end up throwing in the towel and admitting defeat. I cringe every time someone recommends AppleScript. Your suggestion has some merit ... :-) Remember that these are simply warnings. They can be ignored. Yet I like to have a clean slate for BT v3 and iOS 7 combinations. -- Niraj
 
shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
like
01/01/14 06:08 PM (10 years ago)
Thanks for all of your work Niraj.
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
01/01/14 06:10 PM (10 years ago)
ha! I assure you i use the term "Applescript" as a blanket term for 'javascript version for Mac OS X'. (easy scripting) heh heh heh ya even with Automator...its just not that...automatic €
 
tb
buzztouch Evangelist
Profile
Posts: 2050
Reg: Nov 03, 2011
Oxford
32,300
like
01/01/14 08:39 PM (10 years ago)
Thanks Niraj for the fix. You're a real star here. You're willing to get stuck into deep code on New Years Day! Have a happy new year.
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
01/02/14 06:40 AM (10 years ago)
Thanks Niraj!
 
gatorcade
Code is Art
Profile
Posts: 35
Reg: Jul 17, 2011
Gainesville
1,150
like
04/11/15 03:30 PM (9 years ago)
Thanks for the fix Niraj. :)
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.