Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7711281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:20:07+00:00 2026-06-01T01:20:07+00:00

I am working with sqlite database. I retrieve text data from sqlite database into

  • 0

I am working with sqlite database.
I retrieve text data from sqlite database into NSMutableArray named myArray.
In that myArray variable, there is a column named “info” with text data.
After i retrieve that data into NSMutableArray , i would like to convert all of text data from sqlite database into lowercase.
I wrote following code in searchBar’s textDidChange Event like that.

NSInteger counter = 0;
    for(NSString *nameMe in myArray)
    {
        NSRange r = [[nameMe lowercaseString] rangeOfString:[searchText lowercaseString]];

        if(r.location != NSNotFound)
        {
            if(r.location== 0)
            {
                [tableData addObject:nameMe];
            }
        }

        counter++;
    }

However there is a error occurring in lowercaseString.

This error is

2012-03-31 16:28:18.217 SqliteTest[1812:f803] -[MyInfoClass lowercaseString]: unrecognized selector sent to instance 0x6da9210
2012-03-31 16:28:18.276 SqliteTest[1812:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MyInfoClass lowercaseString]: unrecognized selector sent to instance 0x6da9210'

I think that compiler doesn’t know how to convert object data into lowercase.
How can i solve that?
Can i convert object (NSString) data into lowercase.
If it can be,Please let me know how to do that.
Thanks you for your helping.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T01:20:08+00:00Added an answer on June 1, 2026 at 1:20 am

    I think that compiler doesn’t know how to convert object data into lowercase.

    The problem is that objects of type MyInfoClass don’t have a method -lowercaseString. You’re iterating over the array assuming that every object in the array is a NSString, but that’s apparently not true — there’s definitely at least one instance of MyInfoClass in myArray. So, one way to fix the problem is to make sure that you only add strings to the array.

    Here’s a shorter, safer way to do what you’re doing above:

    NSArray *lowercaseArray = [myArray valueForKey:@"lowercaseString"];
    

    NSArray’s -valueForKey: will send a -valueForKey: message with the key you provide to every object in the array, and collect the results in an array. Even better, if some object in the array returns nil, the resulting array will contain a NSNull object at that index. You’ll want to check for those NSNull’s when you use the array, but you won’t get an exception like you do in your code.

    Update: From the OP’s comment, it seems that the reason for converting the array to lowercase is to make case insensitive searching possible. It’s worth pointing out that there are better ways to accomplish that. Here are two:

    • Use NSString’s -caseInsensitiveCompare: method to compare strings, if you’re doing the comparison yourself.

    • If you’re using a predicate to search for a match, use string comparison operators (LIKE, CONTAINS, etc.) with the case-insensitive option: @”SELF like[c] %@”. You may also want the diacritic-insensitive option: @”SELF like[cd] %@”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm working on an iPhone application which retrieve sqlite database from server through json/rest
I'm working some code that inserts csv rows into an SQLite database using Python.
So I got SQLite database working for my app. It loads text values from
I'm working on an Android application that stores data in a SQLite database. My
I m trying to store and retrieve image and text from sqlite database..My saveDatabase
I am working on I Phone app, In that I am using SQLITE database.
I am trying to insert a data into SQLite database using Python. INSERT INTO
I'm displaying entries from SQLite database in Expandable ListView and everything is working correctly
Here's a snippet of code from an sqlite database application I'm working on: my
I’m currently working in c# with a SQLite database file (data.db3) which is located

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.