IOS - Execute external bundles/libraries at runtime - objective-c

I've read lots of things about if it's possible or not.. and I'm a bit confused :S
I'm trying to download from a server a bundle, or something like that and execute it at runtime (a xib with its controllers and own libs).
There are people that says that is possible but not allowed at apple store, other says that there is no way..
It doesn't matter if I can't store it in apple store.
If it's possible, how can I create the bundle or executable file?
How can I link it from the main project?
Thanks!

Related

How can I distribute my objective c library with source code embedded

I would like for people to be able to debug my library, should they feel like they want to.
For this I think a good idea would be to embed the source in the library / framework itself. Does Xcode support this option?
For reference of what I’m looking for, in Java you can build a Jar file which comes with the attached source code (and optional javadoc) embedded within the library https://stackoverflow.com/a/5064833/48062
Xcode does not support this option, no. Your best bet would be to upload the source to Github (https://github.com) and include the link in your documentation for the framework. That way you can be sure that your users can always get to the freshest, most up to date, code.

Importing Code From Online

I know its a bit of a far fetched question.
But is it possible to import code from online, like say I had a .h and .m file on my website server and in the code I wanted to use it would I be able to import it? And How?
I ask this because it makes it loads easier to update an app if all they need to do is reload the app and the app changes to the latest version.
If you're talking about a Mac OS X application, then yes it's possible. No need to share your source code, just compile on the server and have the app download the new binary.
However, if your App needs to go through the App Store, which is necessary for iOS apps, then this surely is not possible. The only thing you can do is streamline the submission process as much as possible (see this question).
If you love the idea of being able to push new code at any time, consider making a web app. There's lots of stuff you can do these days.
I'm not 100% (maybe 95%) sure but I think storing objc code online to keep it auto-upgradable is not possible since the app isn't able to rebuild itself.
But if you want you could do a generic app that firstly fetches an XML/plist (for example) stored online to retrieve data and the app is set to read it and present different behaviours depending on that, but you'll have to code it previously in a generic way to support dynamic changes.
Hope this helps.

Embeding streaming player inside my app IOS

I'm trying to create an iPhone app which plays local radio station in my district. I found this player to work best for me :
https://github.com/DigitalDJ/AudioStreamer
When testing it against my requirements it did the best without any doubt.
I thought I'll use this players API and it should be straightforward(not really for a newbie). How exactly I do that is where I'm stuck now. Because when I run the player original project it runs smooth, but when I copy code inside Classes to my app, this is what happens :
Ok, I've been developing some apps(test apps) for two weeks maybe and I lack experience.
How do you usually embed/import other projects code into your code and user the other codes api?
EDIT
So per Sunil Pandey answer, this cannot be run using IOS SDK version 5.0?
EDIT 2 :
I feel like I'm really close now, have this one issue :
Receiver 'AudioStreamer' for instance message is a forward declaration
It's declared in my h file. as AudioStreamer *streamer
As said Sunil Pandey, ARC mecanism is enabled for your project. With ARC, your project require at least iOS4 on the phone.
I would suggest you to disable ARC for the file you imported from the third party librairy. So you can keep using ARC in your own code (this mean, you never use retain, release, autorelease).
To disable ARC for each file of your AudioStreamer library, refer to How can I disable ARC for a single file in a project?
You must have implemented ARC inside your project. that's why it is giving you this error.
If you are using ARC then only way to use this project library is to create a static library of your AudioStreamer lib and then import it inside your app
Or
If you don't want to use ARC inside your app then you can turn it off by following method
select your target -> Build Setting -> Apple LLVM Compiler 3.0 - Language
set Objective c Automatic Reference Counting to NO

How to compress a file without using any external libraries?

I need to be able to compress file in an iPhone/iPad application. I know there are a few libraries out there that have this problem solved and are easy to integrate in an application, but I was wondering if there is something already implemented in Cocoa. It would help me a lot if I did not need to integrate external libraries in my project.
Do you mean something in iOS / objective-c ? If so, you do know that most objects you are using is an 'external library' i.e. the Foundation framework?
There is, shipped with every iPhone, libz which is the library for zipping / unzipping. You just include it as if it were any other framework.
However, the chances that you will, first time, use it as bug free as an existing library that's been tested for years by hundreds of other developers is slim.
Personally, I would easily choose adding a library over writing my own for something like this - it's been done before, you're just wasting time re-writing it. Try ZipArchive for a one-liner to unzip files etc. Just copy the source code into your app and press build :)
I don't think there is something like that in cocoa inbuild .. but you should have a look here - https://bitbucket.org/kolpanic/zipkit/wiki/Home

Runtime xib downloading?

Is there any chance to runtime xib loading from remote server? Or i need to compile into the build? And if its possible, how can I add remote image resouces in interface builder.
I assumed Bundles could be used but after checking with docs again, it looks like you can't use this. It makes sense. Apple wouldn't want you extend your app's functionality without them reviewing it. Malicious behavior could compromise security too.
So, I doubt you will be able to do this.
It's possible. You can't add functionality though. Check this solution here:
loading NSBundle files on iOS
Worth noting - WeCity probably has a javascript interpreter in it that allows for what you are seeing. Building that is a lot more complicated though.