Thursday 29 September 2011

Compiling PJSIP


Steps to Compile PJSIP latest version 1.10

STEP 1. Download source code from one of the following link :

http://www.pjsip.org/download.htm

http://trac.pjsip.org/repos/wiki/Getting-Started/Download-Source

STEP 2. Set your config_site.h to the following:

#define PJ_CONFIG_IPHONE 1 
#include <pj/config_site_sample.h>

The pjlib/include/pj/config_site.h contains local customizations to the libraries. The simplest way is just to create an empty file, to use whatever default values set by the libraries. Or copy and paste the config_site_sample.h file and delete all its content and copy above two lines.

This will activate iPhone specific settings in the config_site_sample.h.

Note: When the Makefile based build system is used, this process is taken care by the Makefiles. But when non-Makefile based build system (such as Visual Studio) is used, the config_site.h file must be created manually.
STEP 3. To Build PJSIP
Just run:
$ cd /path/to/your/pjsip/dir
$ ./configure-iphone

Their may be following problems:

  • Permission denied 
       Solution: login as super user using su command and the type following command
       $ su
       Password:
       # chmod 777 configure-iphone
       # exit

The permission to the file configure-iphone will be set as rwx (read-write-execute) for all.

  • Again running the ./configure-iphone may give following error 
        -bash: ./configure-iphone: /bin/bash^M: bad interpreter: No such file or directory

(This error may come because in the configure-iphone file every line may have been appended by a character $ or may be a carriage return symbol)
        To check this do as:
        - Run command
          $ vim configure-iphone
          (It wil open the vim editor)
          To see the last character press escape(ESC:)set list
          To quit vim press Esc:q

        - To Eliminate
           $ tr -d '\r' <configure-iphone >FILE.new
(It will create new file with name FILE. Now after that delete the configure-iphone file and rename FILE to configure-iphone using the following commands:)

         $ rm configure-iphone
         $ mv FILE.new configure-iphone
(Again confirm that new created file has 777 permission if no then assign from su- super user)

        - Again run
        $ ./configure-iphone

  • Again there may be error in ./aconfigure: Permission denied 
        Solution : Assign 777 permission to the whole folder.
       - $ cd .. (Go to the parent folder in which the PJSIP folder lies)
       - $ su (login as super user)
       - # chmod 777 * (It will assign 777 permission to the whole folder and its content)

Again run $ ./configure-iphone command. This time every thing should work fine.


STEP 4. After getting message "Done configuring for iPhoneOS4.1.sdk" run following command
     - $ make dep


STEP 5. If every thing is successfull then run following command

     - $ make

(After executing above 5 steps successfully the C files will produce the object .o files for pjlib,pjmedia,pjnath etc. and there .a liabraries that are included into the project and used.)

Monday 19 September 2011

Multiple Reuse Identifier In UITableViewCell


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";
    if (indexPath.row == [temparray count]) {
           CellIdentifier = @"textCell";
    }
    else {
           CellIdentifier = @"otherCells";
    }


    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: CellIdentifier] autorelease];
    }
    UITextField *txtField = [[UITextField alloc] initWithFrameCGRectMake(5, 5, 150, 30)];
    txtField.tag = 45;
    int lastRow = [temparray count];
    if (indexPath.row == lastRow) {
            NSLog(@"%d",indexPath.row);
            [cell.contentView addSubview:txtField];
    }
    else {
            UIView *theView = [cell viewWithTag:45];
           [theView removeFromSuperview];
           cell.textLabel.text = [temparray objectAtIndex:[indexPath row]];
    }
  return cell;
}


Using above function one can create the table view which will contain the tempArray data and in last row a UITextField.

Thursday 21 July 2011

What is DYLD?

DYLD  is the dynamic link editor:  a dynamic linker is the part of an operating system (OS) that loads and links the shared libraries for an executable when it is executed.


When the OS version is updated and system rebooted then on opening terminal we can get a error message as:


 "dyld: shared cached file was build against a different libSystem.dylib, ignoring cache"


To resolve the problem open up the teminal and type following command:

$ sudo update_dyld_shared_cache -force
You should receive a similar response below:
update_dyld_shared_cache[4392] current i386 cache file invalid because /System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv has changed
update_dyld_shared_cache: warning mismatched install path in /System/Library/CoreServices/RawCamera.bundle/Contents/MacOS/RawCamera for /usr/lib/libgcc_s.1.dylib
update_dyld_shared_cache: warning mismatched install path in /System/Library/CoreServices/RawCamera.bundle/Contents/Resources/MetadataLib.dylib for /usr/lib/libgcc_s.1.dylib
update_dyld_shared_cache[4392] current x86_64 cache file invalid because /System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv has changed
update_dyld_shared_cache: warning mismatched install path in /System/Library/CoreServices/RawCamera.bundle/Contents/MacOS/RawCamera for /usr/lib/libgcc_s.1.dylib
update_dyld_shared_cache: warning mismatched install path in /System/Library/CoreServices/RawCamera.bundle/Contents/Resources/MetadataLib.dylib for /usr/lib/libgcc_s.1.dylib

Tuesday 19 July 2011