-1

I've developed an application and I need to remove my computer local path from the generated iPA file.

I did the following:

  1. unzipping iPA file.
  2. click on show package content.
  3. open exec(appname.exec) file with text editor.

Now I can see some binary stuff, and strings with my computer local path (with my mac name).

I have to remove these paths from the exec file, due to security issues. How can I do so?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
BoazGarty
  • 1,410
  • 4
  • 18
  • 38

2 Answers2

1

You cannot do it this way. Firstly it will break the code signature and secondly it's time consuming and error prone.

The correct approach is to not use the complete path in your code and instead use methods like NSSearchPathForDirectoriesInDomains to get the Documents folder, or whatever directory you want to use.

Droppy
  • 9,691
  • 1
  • 20
  • 27
1

As Accessing Files and Directories says:

Although you can open any file and read its contents as a stream of bytes, doing so is not always the right choice. OS X and iOS provide built-in support that makes opening many types of standard file formats (such as text files, images, sounds, and property lists) much easier. For these standard file formats, you should use the higher-level options for reading and writing the file contents. Table 2-1 lists the common file types supported by the system along with information about how you access them.

enter image description here

You have many ways to save your data:

  1. Specifying the Path to a File or Directory
  2. Locating Items in Your App Bundle
  3. Locating Items in the Standard Directories
  4. Locating Files Using Bookmarks

You have chosen to Specifying the Path to a File or Directory,as @Droppy says

Firstly it will break the code signature and secondly it's time consuming and error prone.

You'd better choose to Locating Items in the Standard Directories

Here is why you should choose the way:

Locating Items in the Standard Directories When you need to locate a file in one of the standard directories, use the system frameworks to locate the directory first and then use the resulting URL to build a path to the file. The Foundation framework includes several options for locating the standard system directories. By using these methods, the paths will be correct whether your app is sandboxed or not:

The URLsForDirectory:inDomains: method of the NSFileManager class returns a directory’s location packaged in an NSURL object. The directory to search for is an NSSearchPathDirectory constant. These constants provide URLs for the user’s home directory, as well as most of the standard directories.
The NSSearchPathForDirectoriesInDomains function behaves like the URLsForDirectory:inDomains: method but returns the directory’s location as a string-based path. You should use the URLsForDirectory:inDomains: method instead.
The NSHomeDirectory function returns the path to either the user’s or app’s home directory. (Which home directory is returned depends on the platform and whether the app is in a sandbox.) When an app is sandboxed the home directory points to the app’s sandbox, otherwise it points to the User’s home directory on the file system. If constructing a file to a subdirectory of a user’s home directory, you should instead consider using the URLsForDirectory:inDomains: method instead.

You can use the URL or path-based string you receive from the preceding routines to build new objects with the locations of the files you want. Both the NSURL and NSString classes provide path-related methods for adding and removing path components and making changes to the path in general. Listing 2-1 shows an example that searches for the standard Application Support directory and creates a new URL for a directory containing the app’s data files.

ChenYilong
  • 8,543
  • 9
  • 56
  • 84
  • I changed all the paths to be with NSSearchPathForDirectoriesInDomains, but still I can see local paths. I'm using openCV framework and I can see the developer name string as part of the file path in the exec file . I'm generating iPA for adhoc. – BoazGarty Jun 04 '15 at 09:17