I'm not into objective-C, but if i was i would write a code that only counts spaces and separation signs.
I can write a python code.
"Soit l'expression", "How are you mate?" let s be the number of spaces, and n the number of words, n=s+1, it is noticeable. So that my code in Python2 will be:
expression = raw_input("Enter the expression: ")
i = map(str,list(expression))
def words(list):
    s=list.count(" ")
    return s+1
print words(i)
or
from urllib2 import *
expression = read("%file%path%")
i = map(str,list(expression))
def words(list):
    s=list.count(" ")
    return s+1
print words(i)
hmmm are you sure?

How many words do you count in the following sentence :)
Hello          Lebgeeks!
2 years later
while(str.Contains("  ")) str = str.Replace("  ", " ");
Int n_words = str.Trim().Split(' ').Length;
I could have used lambda, but I'm really bad at understanding them. I will once I finish reading a few.
j=0;s='your text  here   '+'.'
for i in xrange(0,len(s)+1):
  try:
   if s[i]!=" " and s[i+1]==' ':
      j+=1
  except IndexError: pass
print j
      
Johnaudi, NuclearVision,

The requirements state that you need to handle \n \r \t as well.
xterm wroteJohnaudi, NuclearVision,

The requirements state that you need to handle \n \r \t as well.
Alright:
while(str.Contains("  ") || str.Contains('\n') || str.Contains('\r') || str.Contains('\t')) {
  str = str.Replace("  ", " ") = str.Replace("  ", '\n') = str.Replace("  ", '\r') = str.Replace("  ", '\t');
}
Int n_words = str.Trim().Split(' ').Length;
from string import replace
j=0;s='your text  here   '+'.'
for i in ["\t","\r","\n"]:
    s=replace(s,i," ")
for i in xrange(0,len(s)+1):
  try:
   if s[i]!=" " and s[i+1]==' ':
      j+=1
  except IndexError: pass
print j
      
Thanks xterm I missed it :)
If you want to manually iterate over the given string, there's no reason in doing two passes (replace then split) over the content. It would be better if you modified your logic to collect the word count in the first loop. Otherwise;

The python version as seen above would be:
len(text.split())
It's exact C# implementation would be:
text.Split(
    new char[]{' ', '\t', '\r', '\n'},
    StringSplitOptions.RemoveEmptyEntries
).Length;
Thanks xterm I didn't know that split ignores space characters!
Thanks, didn't know we can split through char array.
2 years later
I'm learning Go and I'm leveraging the regexp module:
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"regexp"
)

func get_words_from(text []byte) [][]byte {
	words := regexp.MustCompile("\\w+")
	return words.FindAll(text, -1)
}

func main() {
	filename := "main.go"

	data, err := ioutil.ReadFile(filename)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d\n", len(get_words_from(data)))
}