Browse Author: trupti.karale

Applying Query in core data

There are few cases when we prefer to use Core data that Sqlite. Core data is faster in fetching records than SQLite. As like sqlite we can fetch data by specifying query in Core data.

Following is the way to set your query for fetch request of core data.

let request = NSFetchRequest()
if #available(iOS 10.0, *)
request.entity = EmpData.entity()
request.entity = NSEntityDescription.entity(forEntityName: “EmpData”, in: context)

let name = “Ram”

request.predicate = NSPredicate(format: “empName == %@”,empName)

let results = try context.fetch(request)




Also Some times we required to fetch only few number of records each time. For example you have large amount of data then we need to fetch data in batches.

Following is the code to do this

request.fetchLimit = 100
request.fetchOffset = recordCount

where fetchLimit is amount of records you want each time to fetch and fetchOffset is from where to start. Here recordCount is the counter to keep track from where to start the fetch for next time.

Get CrashLogs with Fabric Crashlytics

Crashlytics provides deep and actionable insights, even the exact line of code your app crashed on. While Crashlytics gives you powerful crash reporting, with one additional click you can enable real-time analytics that help you understand what’s happening in your app.


1. Add kit to your Podfile.

pod ‘Fabric’
pod ‘Crashlytics’

Then run following command in your terminal

pod install

2. In Project Navigator select your project from targets -> go to Build Phase -> click on plus button and add “New Run Script Phase” and paste following code

“${PODS_ROOT}/Fabric/run” ba500759ec59e71c692c2e3e003edd73e25207c2 13fd4768392c1fb440b9bb7447dab03757c569a498a25c7e667fdbdefd52f57b

3. Add API in Info.plist file



Initialize Your Kit

In AppDelegate. swift file

import Fabric
import Crashlytics

Then in application DidFinishLaunch method



To get User Information

  • Add following method in your appDelegate file and call this method after  Fabric.with([Crashlytics.self]) this
  • line of code.
  • func logUser() {
    // TODO: Use the current user’s information
    // You can call any combination of these three methods
    Crashlytics.sharedInstance().setUserName(“Test User”)




Zbar SDK is not working well in iOS6

To solved the problem follow the steps:

  1. Go to the ZBar homepage and navigate to the mercurial repository (direct link)
  2. Download the zbar repository as zip.
  3. Unzip the file and navigate to the subfolder named “iphone”.
  4. Open the XCode project.
  5. Delete the “Examples” folder (the folder caused a build error on my machine).
  6. Hit “CMD + B” and build the source.
  7. Find your new libzbar.a file. (User/Library/Developer/Xcode/DerivedData/zbar…)
  8. Replace the old libzbar.a file in your project with the new one.
  9. Hit “CMD + R” and you are good to go.


How to access passes from passbook in app?

Create AppId which is similar to passTypeIdentifier. For example if your passTypeIdentifier is then your AppId must be .While creating provisioning profile make use of this appId and make use of this provisioning profile for your app. Then only you will be able to distinguish passes available in your passbook.

Also, Keep in mind that the App ID you signing your code with should be Enable for Passes on the Provisioning portal as well.


Need more help?

Hi there, was your problem or query resolved? If not & need more assistance, please do reach out to us at, we'll be more than delighted to help. Nanostuffs has 7+ years of extensive Salesforce & iOS/Android experience.
Holler Box