Posts

Showing posts from December, 2017

Storyboard error after commit from github or sourcekit conflict changes

Solution: Its because of derived data cache.no worries if you had changed from sourcecode in story board if it was no errors then quit the xcode and reopen it again.The storyboard will works fine...

Fetch the objects from Coredata and return it as NSMutableArray iOS Swift

Solution: If you have to fetch the array of objects form coredata and display it in a tableView then don't worry here is the example. The below example had the fetch the objects from coredata orderedobjects also it had a condition with except the particular value fetch all the object predicate also there.Finally return the fetched objects using predicate from coredata.  func getallData () -> NSMutableArray {     let myArr: NSMutableArray = NSMutableArray ()     let appDelegate = UIApplication . shared . delegate as ! AppDelegate     //create a fetch request, telling it about the entity     let fetchRequest: NSFetchRequest < ENTITY > =  ENTITY . fetchRequest ()               fetchRequest. predicate = NSPredicate (format: "NOT (attribute == value)" )      do {         let searchResults = try appDelegate. getContext (). fetc...

Navigation Bar set for all Devices

Solution:  The below code is used for set the navigation bar title correctly for all devices.         UIBarButtonItem . appearance (). setBackButtonTitlePositionAdjustment ( UIOffsetMake ( 0 , -60 ), for: UIBarMetrics . default )          UINavigationBar . appearance (). tintColor = UIColor . white

Local Notification sound not came when App in foreground iOS Swift

Solution:  If app is in foreground the notification sounds will not be played.So you have to manually play the sound to notify the user.Use the below code to play the sound      var sound: AVAudioPlayer !                         if appstate. applicationState == . active {                             let sound =  "soundname"                              let alertSound = NSURL (fileURLWithPath: Bundle . main . path (forResource: sound, ofType: "mp3" )!)                             do {                                 self . sound = try AVAudioPlayer (contentsOf: alertSound as URL )...

How to create widget or Today extension in iOS Swift

Image
Solution: Step 1:  Select your project then goto Capabilities in that below select app groups and On it.` Step 2: Click the plus icon.It will show one text box.Then enter group.com.companyname.appname. Step 3:After that select the check box to enable Step 4:Goto your iOS app developer account and then enable the app groups in your app in the app dependency section.And then regenerate the certificates and download it and add to your keychain access.Also enter the groups name will be like group.com.companyname.appname. Step 5: Goto editor in the Xcode menu then select Editor->Add Target->search today extension and add it to your project. Step 6: It will generate a folder like whichever you want.Expand that folder.It will had a Viewcontroller. Step 7:  In widget class add the extension like below. class TodayViewController: UIViewController , NCWidgetProviding { } Step 8:  Add the two delegate methods like below.  widgetActiveDi...

Create versioning in CoreData

In Your Xcode select .xcodemodeld file then goto Editor menu in xcode then select Add model version.it will show dialogue box with basic model and current model.select the basic model and then select create. Finally you want to change the active model version.Select the newly created model in left panel and then goto right side first menu then in Model Version segment select your newly created model.Finally it will show green tickmark in the current model version.

Testing GPS in simulator with Fensing

Solution:   It was not possible in simulator with realtime location updates.But you can create a fencing files and test it in a simulator. Goto file->new in your xcode and create a blank file or goto textEdit and create an empty file and save it as filename.gpx and then drag into your xcode. Write code into the file like below. <?xml version= "1.0" ?> <gpx version = "1.1" creator = "Xcode" >     <wpt lat = "43.1257858" lon = "-79.0912399" >         <name> Niagra </name>     </wpt> </gpx> I had named the location name as Niagra with lattitude and longitude. Run your app in the simulator.Goto Debug->Simulate location and selecet your file.Then the simultor location is changed to your mentioned location.

CORDOVA "cannot read property 'variables' of undefined cordova" Error

Problem: Because of Cordova configuration file issues.We cannot able to recover it to build your project.Do the backup of your project before doing the below solution. Solution: It's better to remove the platform and reconfigure it or you can try to go ahead from the initial step to create the project and proceed with that.

CORDOVA "It may be caused by an invalid GOOGLE_APP_ID in GoogleService-Info.plist or set in the customized options" error

Error: Terminating app due to uncaught exception 'com.firebase.core', reason: 'Configuration fails. It may be caused by an invalid GOOGLE_APP_ID in GoogleService-Info.plist or set in the customized options.' Solution: The problem is GoogleService plist configuration fails. Download the  GoogleService-Info.plist from the Http:// console.firebase.google.com and then paste it to the below locations  platforms/ios/<Your Project>/Resources/  and  platforms/ios/<Your Project>/Resources/Resources.

ItunesConnect build Not showing but application loader uploaded with no issues

Image
If you had tried to validate the app in application loader it shows validation success.After that you had tried to upload the app in the app store then it shows no error.If you checked with activity in the itunesconnect it shows processing.After that the build is gone then don't worry. Try the below steps your headache will gone. Goto your app target and click the info tap below the info you had missed to give the photo library usage description or location service access usage description. Give the above descriptions and upload the app into the itunesConnect your headache will gone.. If the above issue is not in your app then goto check with the assets library because if it had issues then also the problem will occur.You must had the 1024 icon set because it must.Also check if any unassigned child in the icon set.