Posts

Showing posts from October, 2019

Vertically align text to top iOS UILabel

Solution: You cannot be able to align the label vertically.At the same time you can be able to set the number of line in UILabel.If you set that number of lines only if you want constantly particular number of lines. For example if you want that label will display only 2 lines then set the number of lines to 2. Otherwise you have to set that number of lines equal to 0 and call sizetofit. myLabel.numberOfLines = 0 myLabel.sizeToFit()

Xcode 11 creating project don't had storyboard and also swift file had different

Solution: In xcode 11 it had two different options available for app creation. 1.swiftUI framework 2.Storyboard framework By default swiftUI is selected.If you want storyboard based you must have to select that on the time of project creation.

Xcode 11 simulator hangs when type in textField inside app

Solution: Yes this issue is happening in xcode 11.If it occurs you must have to quit the simulator and run it again will be solved.Don't wait for recoverance. It's an xcode bug not your app issue.

Change the image background Color to white

Solution: If you don't know the photoshop then don't worry.Follow the below steps to change the backgroud color to white to your image. 1. First open the site link below https://www.imgonline.com.ua/eng/replace-white-background-with-transparent.php In that site scroll down and find that choose file option. Click on that it will get your file from your computer. Click the ok button below to convert your uploaded image background color to white. Finally click the download to download your converted image..Enjoyyyy...

iOS swipe down to close for popupview || iOS latest feature

Solution: In iOS 13 there is a huge option that will popover one view to another and swipe down the view to close. We can see how to achieve that. Code:              let  anotherView =  self . storyboard ?. instantiateVi ewController (withIdentifier:  " anotherView " )              if   #available ( iOS   13.0 , *) {                 anotherView?. isModalInPresent ation  =  false             }  else  {                  // Fallback on earlier versions             }              self . present (anotherView!, animated:  true , completion:  nil ) The above code is for present the view and swipe down we can close that.

Change background color of an image in MAC

Solution: 1. Open the image using preview in MAC. 2.In top of the menu select preview -> Preference -> General 3.Option shown as window background -> select on that color pallete. 4. Change the colors whatever you want and save.

Extend the width of button using swiftUI.

Solution: struct myButton: ButtonStyle {     func makeBody(configuration: Configuration) -> some View {         configuration.label             .padding()             .frame(minWidth: 0,                    maxWidth: .infinity)             .foregroundColor(.white)             .padding()             .background( RoundedRectangle(cornerRadius: 5.0).fill(Color.orange)         )     } } Use the button be like below. Button(action: { self.isActive = true }) {         Text("Login")            .fontWeight(.bold)     }   .buttonStyle(myButton())

iOS 13 Features

3D touch: It's used for app shortcuts in 3D touch to show functions to the user. Battery: Charging optimisation for long life battery is available on iOS 13.If your iPhone is charged 80% then you can set it as morning alarm for battery charging. Control Center: Without opening the settings you can access the bluetooth and wifi directly. App downloads: App download limit for 200MB is gone in iOS 13.You can enjoy the unlimited app download limit. Files: You can easily zip and unzip the files in the iPhone. You can also create nested folders in the folder app. Keyboard: Finally swipe keyboard is available in iphone.You can enjoy the swiping to type the words like android Phone. Share: Share options are ultimately mass to the user can share within few taps.

iOS app crashed on device.dyld library not loaded

Solution: In general tab there is an embedded binaries tab.In that tab click + button and add the exception told framework to your project .It will resolved the problem

XCode error on simulator MGIsDeviceOneOfType is not supported on this platform

Solution: 1. Goto your target select edit scheme. 2. In left menu select Run 3.In Top menu select arguments. 4. Select + then  OS_ACTIVITY_MODE set the value to be disable. 5.Clean the project and run.It will works good...

XCode 11 simulator not launching issue iOS swift

Image
Solution: If you are freshly install the xcode then you must have to download and install iOS simulators using below steps. 1.Open Xcode 2.On top menu click XCode and select preference. 3.  4.In above menu select components. 5.Download the simulators with iOS that you want.After installation launch the xcode clean the app and run..Simulator will launch quickly

Etsy account rules || ETSY account blocked

If you are want to sell your product online in ETSY you must want to follow some set of conditions. 1. First you must have to create an account in one laptop and internet connection in particular cellular network then in future must be use that same. Otherwise your account will be blocked from their side at a particular set of time.So be careful to use that. Also you cannot have to use others images and products.If your product get blocked it will be blockmark to you and after sometime your account will be blocked.

How to set Two factor authentication with phone number in GMAIL || Gmail phone number SMS verification when try to login

Solution: 1) Login into Gmail and click your profile icon and select google account 2) In left menu select security. 3) In right side select two step verification. 4) It will get your password of your Email and set that to on. 5) After that every time you login into your email it will send you an sms code after you enter that only you can login to your account.

iOS crash when try to load automatic dimention for tableView or CollectionView

Solution: If you are tried that automatic dimention that tableView or Collection View will load the content with automatic height then sometimes this problem occurs. So better you can set the height in constant and run the app it will works good.

Delete trash MAC issue || Empty trash MAC hangs

Solution: If you are deleted the max number of files.It will be trash then if you tried to delete that then MAC will be hanging.Because first it will fetch the item count.If it was large then mac will be getting hanged. Also if you tried to delete the Xcode then empty the trash then definitely mac will be very slow. We had a better solution to solve that. 1. If you had more number of files then delete small set of files and try it in few more times. 2. If it will be Xcode then right click on that and select the option that show package contents and then delete small set of files.You can easily delete all the files within a few times.

Could not attach PID iOS simulator launching error

Solution: When you run your app if it show that could not attach PID error then follow the below steps to solve that. You can understand that it is a cache issue. 1. So first goto derived data and delete all. 2. after that delete the app in the simulator. 3. Goto hardware reset content and settings in simulator. 4.Clean the project in Xcode. 5.Run the app it will works good.

EKRecurrence rule iOS swift

Solution: You can be use ekrecurrence rule for repeating the event scheduling without using for loop. you can also add the alarm to the event. recurrenceWithFrequency - it will be weekly,yearly,monthly,.daily daily schedules with end date or without end date you can add. If you given the monthly and start date it will be generated every month that date.In year every day,month it will be repeatable. interval - it is used for interval of the event. daysOfTheWeek - you can give the day numbers like sun -1,mon -2 daysOfTheMonth - you can give the value between 1-31 or -1 to -31 monthsOfTheYear - You can give the numbers with 1 to 12 end - end date you can give Code: let event = EKEvent(eventStore: self.eventStore) event.title = title event.startDate = fourthOfJulyStartDate event.endDate = fourthOfJulyEndDate event.addRecurrenceRule(EKRecurrenceRule(recurrenceWithFrequency: .Yearly,     interval: 4,     daysOfTheWeek: nil,     daysOfTheMonth: [NSNumber(int: 4

How to disable the tableView selection

Solution: You can disable the selection during the editing the table view using the below code. you can use the below code in the viewdidload tableView.allowsSelection = false

Delete row from tableView or CollectionView crashes

Solution: Before that you have to know that your data array must be delete the value before updating the tableView or collectionView Also number of rows or number of sections will be sometime problem.

UIImageOrientation inn swift 5

Solution: UIImage orientation is changed as below in swift 5 Swift 4: UIImageOrientation swift 5: UIImage . Orientation

NSForegroundColorAttributeName in swift 5

Solution: Swift 4 : NSForegroundColorAttributeName swift 5: NSAttributedString . Key . foregro undColor

UIImagePNGRepresentation in swift 5

Swift 4:   UIImagePNGRepresentation( self )   Swift 5: self . pngData ()

Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (3) must be equal to the number of rows contained in that section before the update (3), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted).

Problem: Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (3) must be equal to the number of rows contained in that section before the update (3), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted). If i delete the row and set the datasource then it shows the above exception. Solution: You have to reload the data in the tableView or collectionView will solve the problem.Also before delete the row must have to delete the particular index in your array or dataSource

UIBarButtonItem appearance in swift 4 and swift 5

Solution: Swift 4:          UIBarButtonItem . appearance () . setBackButtonTitlePositionAdj ustment (UIOffsetMake( -200 ,  -5 ), for: . default ) swift 5:          UIBarButtonItem . appearance () . setBackButtonTitlePositionAdj ustment ( UIOffset (horizontal:  -200 , vertical:  -5 ), for: . default )

Font with attributes in swift 4 and swift 5

Solution:          let  attrs = [ NSParagraphStyleAttributeName: style, NSForegroundColorAttributeName : UIColor . white , NSFontAttributeName: UIFont ( name:  "Trebuchet MS" , size:  20 )] swift 5:          let  attrs = [ NSAttributedString . Key . paragr aphStyle : style, NSAttributedString . Key . f oregroundColor : UIColor . white , N SAttributedString . Key . font : UIF ont (name:  "Trebuchet MS" , size:  20 )]

image with name in swift 5 || fetch image by name in iOS

Solution:   In swift 4 we can use the below code to fetch image by name UIImagePNGRepresentation( UIIma ge (named:  "imageName" )!)! Swift 5: return   UIImage (named:  " imageName " )!. pngData ()!

CMTimeRange in swift

Solution:              let   range:   CMTimeRange   =   CMTimeRangeMake (start, end) Swift 5:              let  range:  CMTimeRange  =  CMTimeRangeMake (start: start, duration: end)

CMTimeMakeWithSeconds in swift 5

Solution: CMTimeMakeWithSeconds ( 1.0 ,   600 ) In swift 4 we are used the above code for CMT. Swift 5:              let  start:  CMTime  =  CMTimeMakeWithSeconds ( 1.0 , preferredTimescale:  600 )

AVFileTypeQuickTimeMovie in swift 5

Solution: In swift 4 we can use the below code to represent the movie using the below representation AVFileTypeQuickTimeMovie Swift 5: AVFileType . mov In swift5 use the above code to represent the movie...

UIImageJPEGRepresentation not available in swift 5 || Image to data conversion in swift

Solution: In swift 4 we can use the below code to convert the image to data Swift 4:  UIImageJPEGRepresentation( savingImage, 0.5) swift 5: savingImage. jpegData ( compressionQuality:  0.5 )

UIEdgeInsetsMake in swift 5

Solution: Swift 4: UIEdgeInsetsMake is used in swift 4. Swift 5: UIEdgeInsets (top:  0 , left:  -10 , bottom:  0 , right:  10 ) Use the above code for  UIEdgeInsetsMake

NSAttributedString in swift 5

Solution: swift 4: try NSAttributedString(data: Data(utf8), options: [ NSDocumentTypeDocumentAttribut e: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAtt ribute: String.Encoding.utf8.rawValue] , documentAttributes: nil) swift 5: return   try   NSAttributedString (data:  Data ( utf8 ), options: [ NSAttributedString . DocumentRe adingOptionKey . documentType :  String . Encoding . utf8 . rawValue ] , documentAttributes:  nil )

Install app without DIAWI || Install IPA directly to iPhone || Alternate to DIAWI

Solution: 1) First clean the app using the command shift+command+k 2) After that build the app using the key command command+b 3) You can find your ipa app inside the file directory with your app name.Right click on that and show in finder 4)Paste into one folder.Compress the folder and rename it into appname.ipa 5)Connect your phone to the MAC open xcode goto->Windows->devices and simulators->User that select + then select your app file in that.It will directly installed to your phone. 

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: Z8TITLE)'

Solution: If you are tried to set declare the dictionary and then set the values on run time is raised the problem.So if your values will be changable at runtime then must use NSMutableDictionary then assign the values to that.

UICollectionView invalid number of items crash problem and solution || UITableview invalid number of items crash problem and solution || swipecellKit delete issue

Solution: If you are delete the row or section before you must have to delete the value from the array that you had used for the tableView or collectionView. If you are used the swipecellKit must follow the below steps. You have to implement the below delegate method only. func collectionView(_ collectionView: UICollectionView, editActionsForItemAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? { } Don't implement the below  function because it will delete the row immediatly so.Bo of rows or number of section issue will be occur func collectionView(_ collectionView: UICollectionView, editActionsOptionsForItemAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> SwipeOptions { }