How to create dynamic library frameworks for iphone - iphone

I want know about how to create dynamic library frameworks for iphone..
Any ideas about this..please guide me...

Dynamic linking is forbidden if you want to deliver to the App Store (apart of the Apple provided libraries and frameworks, of course). Only static linking of external libraries is allowed by Apple.
Edit: (quoting myself from a comment to a different question) The reason is security: since a dynamic library can be loaded and unloaded at runtime you could download additional executable code and load it (think plug-in). This could get compromised by a hacker and then having malicious code executing on your phone is a very bad thing. It would also make it possible to add unapproved features to an approved app. In short: in this environment, Apple considers dynamic linking to be a Pandoras box that must be strictly controlled, otherwise it could compromise security and I agree that it does make sense on the phone.

This simply isn't supported for various reasons.
Use static libraries instead, or compile the source directly into your project.

Related

what is difference between library file and framework?

I couldn't get clear idea in differences between framework and libraries, can you suggest your idea or refer me any website or article thanks.
Apple's Doc is always a good place to start:
https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPFrameworks/Frameworks.html
In sum, Frameworks are an Apple specific mechanism for packaging dynamic code in a well defined directory structure. Frameworks are a particular type of Bundle which allow for versioning, storing and loading resources (icons, string files). Dynamic libraries provide only the shared module (with the *.dylib extension).
Note, OS X supports both methods, but Frameworks provide a great deal of flexibility both in development, deployment and management and are usually the preferred choice.
Using Frameworks requires compiler/linker specific flags to properly use. You should consult the Clang/XCode documentation.

Is it ok to include other frameworks or libraries in my framework?

Background: I am about to start preparing my 1st framework for my clients, so they can easily integrate it into their apps and fetch data from my servers without dealing how communication with server is working. I chose ASIHTTPRequest library for communication.
Question: how should I deal with ASIHTTPRequest or any other static library - make it a part of my framework or let adopters link against it themselves in their projects?
I'm opting to make it a part of my framework, so I can prevent users from setting breakpoints in ASIHTTPRequest and easily access/log connection frames/data. But what would happen if my clients will need this library for their own purposes? Will they be able to link it second time? Won't it cause any run-time collisions?
Sorry for wording... Please let me stand corrected if I'm confusing any terms :)
Look at how ASIHTTPRequest handle it :)
They make you link against lots of the iOS frameworks but they don't ship them with their download.
However, they do ship code for Reachability with their library - if you don't already have it then you can include it. If you already have it in your project then that's OK too.
I would ship the source of ASI in a seperate folder - then your users can either include it or not.
That also has the benefit of ensuring that the version of ASI they use will work with your library ;)
(see the ASI docs here)
There are two different types of frameworks to consider, so I would do two things:
For any third party library like ASI that you use, include a
directory with the source as deanWombonurne indicated. Make sure to indicate which version of the library you have included if it is not clear (add a VERSION) file if needed or name the directory).
For Apple frameworks, include a manifest file somewhere that gives a
list of all the Apple frameworks they should include in their
project to satisfy your framework requirements.

How to use iPhone SDK Private APIs

I haven't found a comprehensive list of the steps that are required to use a private API from the iPhone Library.
In particular, I would like to know how to get header files, if they are even required, how to get it to compile (when I simply add the header, it complains that the functions aren't defined), and what resources one can use to learn about private APIs (e.g. from other user's experiences, such as http://iphonedevwiki.net/ which has a few).
I've read in other places that people recommend using class-dump to get the headers. Are there any alternative methods? I've noticed that there are some repositories of iPhone Private SDKs, what are the most up to date resources you would recommend?
Most of the previous questions about documentation of private APIs, have all linked to Erica Sadun's website, which doesn't seem to have documentation anymore (all the links on the left are crossed out).
Please save the comments about not using private API's... I know of the biggest risks:
App will get rejected by Apple.
App will break in future updates to the OS.
I'm talking about legitimate uses, such as:
Private application use (e.g. for unit testing, or messing around to see what's possible)
Objective-C has enough information in the compiled binary to almost completely reconstruct the headers. The only things missing are argument names, which can often be approximated from the type or method prototype, and some structure and enum definitions. That is why programs like class-dump are the best way to get the headers. They are comprehensive, including every method whether it was in the real header or not, up to date and do not need to be distributed. The other way to get headers is to look in the public version of the same framework, for example WebKit is only private on the iPhone and is otherwise well documented.
If you are interested in things besides Objective-C you pretty much have to do it the old fashioned way, slogging through disassembly to guess function arguments. Once you get a few symbols, search for them and maybe you will find a header someone else has posted. otool is a good place to start.
If you include the headers, be it for Objective-C or C, you must also include the frameworks or libraries the headers declare methods for, just like any other headers. Most of the Objective-C stuff is in a PrivateFrameworks folder right next to the regular Frameworks folder. You can look in the usr/lib folder to find libraries.
Be aware that there are lots of differences between the simulator and the device, so make sure you build headers from the real device. There are also some of methods that you will not have permission to run as a sandboxed app.

iPhone app rejection for using ICU (Unicode extensions)

I received the following mail form Apple, considering my application:
Thank you for submitting your update to Νομοθεσία to the App Store. During our review of your application we found it is using private APIs, which is in violation of the iPhone Developer Program License Agreement section 3.3.1; "3.3.1 Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs." While your application has not been rejected, it would be appropriate to resolve this issue in your next update.
The following non-public APIs are included in your application:
u_isspace
ubrk_close
ubrk_current
ubrk_first
ubrk_next
ubrk_open
If you have defined methods in your source code with the same names as the above mentioned APIs, we suggest altering your method names so that they no longer collide with Apple's private APIs to avoid your application being flagged with future submissions.
Please resolve this issue in your next update to Νομοθεσία.
Sincerely,
iPhone App Review Team
The functions mentioned in this mail are used in the ICU library (International Components for Unicode).
Although my app is not rejected at this point, I don't feel very secure for the future of my app, because it relies heavily on the Unicode protocol and on this components in particular.
Another thing is that I do not call these functions directly, but they are called by a custom 'sqlite' build (with FTS3 extensions enabled).
Am I missing something here?
Any suggestions?
I would recommend not publicly venting about the issue (that will only hurt you in the long run), but responding politely to the application review email address you were given, explaining that you are using a custom SQLite build which references the ICU framework. Given that this is a standard third-party framework, I would argue that these are not Apple's private APIs that you are using. It may be that they were simply overzealous in the inclusion of symbols in their scanning software.
If you are unable to convince them otherwise, you might contemplate switching from SQLite with FTS3 to something like Aaron Hillegass' BNRPersistence, which just added fast full-text searching.
If they have trouble with linking to the system ICU, why not simply import the ICU source code into your project?
Hmmm...it is possible that Apple also uses ICU components. The best response would be to politely explain what's going on, and hopefully things should sort out okay.

Static (iPhone) libraries, distribution, and dependencies

(Presumably the following question is not iPhone specific, aside from the fact that we would likely use a Framework or dynamic library otherwise.)
I am building a proprietary iPhone SDK for a client, to integrate with their web back-end. Since we don't want to distribute the source code to customers, we need to distribute the SDK as a static library. This all works fine, and I have verified that I can link new iPhone apps against the library and install them on the device.
My concern is around third party libraries that our SDK depends on. For example we are currently using HTTPRiot and Three20 (the exact libraries may change, but that's not the point). I am worried that this may result in conflicts if customers are also using any of these libraries (and perhaps even different versions) in their app.
What are the best practices around this? Is there some way to exclude the dependent libraries' symbols from our own static library (in which case customers would have to manually link to both our SDK as well as HTTPRiot and Three20)? Or is there some other established mechanism?
I'm trying to strike a balance between ease of use and flexibility / compatibility. Ideally customers would only have to drop our own SDK into their project and make a minimal number of build settings changes, but if it makes things more robust, it might make more sense to have customers link against multiple libraries individually. Or I suppose we could distribute multiple versions of the SDK, with and without third party dependencies, to cover both cases.
I hope my questions make sense... Coming mainly from a Ruby and Java background, I haven't had to deal with compiled libraries (in the traditional sense) for a long time... ;)
If it were me I would specify exactly which versions of those 3rd party libraries my library interoperates with. I would then test against them, document them, and probably deliver with those particular versions included in the release.
Two things I would worry about:
-I would want to be sure it 'just works' when my customers install it.
-I wouldn't want to guarantee support for arbitrary future versions of those 3rd party libraries.
It is fine to include a process for the customer to move to newer versions, but if anything doesn't work then I would expect the customer to pay for that development work as an enhancement, rather than it being a free bug fix (unless you include that in the original license/support arrangement).
At that point it becomes an issue of ensuring your specific versions of the 3rd party libraries can work happily alongside anything else the customer needs (in your case a web back-end). In my experience that is usually a function of the library, e.g. some aren't designed so multiple versions can run side-by-side.