I have some problems with creating static libraries.
Let say I have the static library A which I created and I included that to static library B with the relevant header files. I need to create a static library C which will be my final library and it it should include static library B which implicitly include the static library A. So I need to hide both implementation details of library A and B in the library C but it should not visible to the end user. Only an interface will be provided.
1) So let say my static library A uses some dependencies which are some libraries in the SDK. So do I need to import in my final project although I included the library C?
At the moment I am having some build issues when I tried above.
2) Can we bundle 3rd party static libraries inside our static libraries and distribute only our library?
3) Let say we are downloading some 3rd party code. Using that we are creating static libraries. Can we distribute a static library using 3rd party code. If so do we need to expose the code?
4) How does the static library acceptance in App store. Is it like the normal process? (I mean projects bundles with static libraries)
Thank you,
Regards,
Dilshan
Wow. Four questions. If only I could get 4x the rep. :)
Yes, you need to include the frameworks in the App's project. Linking a framework in a static library only creates references to symbols that don't exist. These need to be resolved during app link by linking in the frameworks to the final app.
I take it you're thinking about selling an SDK of static lib files and header files. Yes, it is technically possible to link it all into one giant library (see ar(5) for details) and ship the library and select header files, but see answer #3.
Depends on the license for the third-party library. Consult legal counsel if you have questions.
Most apps have a static library linked in to the app. For example, the vast majority of free apps include AdMob or similar advertising packages, which are distributed as a static library. A static library doesn't, per se, violate any Apple submission policy, but the library can violate a policy, such as including undocumented APIs. If the static library violates a submission policy, an app that uses it will be rejected, even if the app doesn't use that feature.
Incidentally, you can't completely "hide" the interfaces of library A and B (from your example.) If you could, Apple would and it would not be possible to use undocumented APIs. All you can really do is leave them out of the headers and documentation.
Related
I'm trying to build some features using function builders (#_functionBuilder included in Swift 5.1).
I know using private framework APIs is disallowed, but does the same apply for private language features?
I have tried looking this up but couldn't find any relevant information on the topic specifically addressing this. Grateful if anyone can help me with this.
I share a Data Transfer Object between an C# Azure Mobile Services server and client. I use the same class in both applications.
The TableController class used by Azure mobile services requires the DTO to inherit from 'EntityData', which in turn implements interface 'ITableData'.
ITable Data lives is part of reference:
Microsoft.WindowsAzure.Mobile.Service.Tables
I have not figured out how to include that reference without installing the entire server-side mobile services package in nuget:
WindowsAzureMobileServices.Backend
That includes OWIN, and many other references the client does not need. This is what I am doing currently. This works for a desktop application I am currently working on, but I think it will not work for universal apps and windows phone apps.
I also looked at microsoft's samples for mobile services, and there they use separate classes as DTOS for server and client.
Is it really the case that we have to write the same code twice?
No, but you could better make use of Shared Projects, and partial classes.
Your Shared Project will have common properties for the entities.
Other projects will reference this Shared one, and can add some other properties to shared entities, still using partial classes.
I have precise experience with AMS, so I know what you are meaning.
In my experience, is anyway not realistic to think to have exactly the same entity classes for client and server.
For instance, in so called Portable Class Libraries you can have a very small subset of framework, and references available.
Other than properties, you normally put attributes on POCO class files. On the client you may have some attributes that aren't available/meaningful for the server (e.g. SQLite attributes), or viceversa. You may can get stuck in this situation also with the shared projects approach I suggest, but it could be managed there with what so called preprocessor directives.
im trying to build a framework that uses methods from a 3rd party framework.
I would like to hide the methods 3rd party framework from being accessible by the user of my framework.
I tried compiling using static library method and framework method.. but the 3rd party framework doesn't seems to be included in my framework..
any one know how can i bundle the 3rd party framework in my library file?
any help is much much appreciated.
It's not possible to include a static library or another framework inside an home-made framework. The user will need to add both your framework and a static library (3rd party methods) in its project to be able to use it.
There is nothing wrong in having a dependency in your static library / custom framework. Simply inform the user about it and, if possible, bundle the depended library in your distribution.
ObjectiveC does not allow the usage of namespaces, hence there is no way to "hide" the methods of a static library effectively.
I update my application from version 1.0 to version 1.1 and I submit my iPhone App to Apple a week ago .Few minutes ago I got this Report from Apple that
We found that your app uses one or more non-public APIs, which is not in compliance with the App Store Review Guidelines. The use of non-public APIs is not permissible because it can lead to a poor user experience should these APIs change.
We found the following non-public API/s in your app: setContentToHTMLString.
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 in future submissions.
Additionally, one or more of the above-mentioned APIs may reside in a static library included with your application. If you do not have access to the library's source, you may be able to search the compiled binary using "strings" or "otool" command line tools. The "strings" tool can output a list of the methods that the library calls and "otool -ov" will output the Objective-C class structures and their defined methods.
These techniques can help you narrow down where the problematic code resides.
Please tell me, What to do to resolve it?
If you are using:
setContentToHTMLString
Don't use it anymore, if its a private API method and Apple doesn't want you to use it
If you are using a method in the private API, then you will have to find an alternative function. Either from a library or write your own.
If you have written a function named setContentToHTMLString then rename the function (you might like to prefix it- perhaps mySetContentToHTMLString) and change all of the usages over to your new name.
Then you'll be able to resubmit.
setContentToHTMLString is an undocumented method of UITextView. You may need to remove it. You are NOT allowed to access the private API.
I'm pretty new to static libraries. I recently created one library because I have a lot of source code, and the updates of my projects ended as a nightmare.
So, this is a static library for iPhone.
My question is quite simple : I use this library for me and my company. But, how can I use a portion of it to make projects for my clients ? For example, I have a class which reads PDF or Photos, depending of the initialization parameters.
I don't want my client able to use the photo part, just by seeing the headers. How can i achieve that ? I thought to remove some parts of the headers i will give to my client, but i'm pretty sure there are better options.
Thanks
Presuming you are using objective C code, it will not be enough to just remove the headers since a smart client will be able to "ask" the code about its interface by using class-dump.
So if you want to be certain that the code is not available to your clients, you need to remove it completely from your static library.
Update:
CocoaReverseEngineering provides information about how to access the hidden information in frameworks and libraries. But you can also use it so you know what's possible and thus preventing it happening.