Managing an iphone app from another app - iphone

We have an architecture where we have a library that we use to automate the application A, which is closely coupled with the app. (Directly linked within A). We had to write a wrapper around the library for customizations within A.
Now we want to separate the library from the application A's code and port wrapper out of A.
For this, we thought of creating a workspace and managing multiple projects there.
Now, the part where I am stuck is, I have to write an app B that links this library and application A. All the wrapper code we wrote for A should reside in this app B. None of the code should reside in the A's repository. B can be anything, that helps Automate A without effecting A's repository. A will have no reference of library / B.
Is there any way we can do it?
Can we do this by making B as a plugin for A? If so, is there any way to support this? I am very new to this, so any kind of guidance is greatly appreciated.
PS: I do not want to launch an app from other. Instead, I want an app to be running, and a way to manipulate it via external source than the application itself.
If any information is missing, please let me know.
Thanks,
RKS

You can register a custom URL scheme in application A.
In application B simply call [[UIApplication sharedApplication] openUrl:myURL].
Finally application A get called through application:handleOpenURL:
See also:
Communicating with Other Apps
URL scheme index

Finally figured out a way to do this. Here is how it goes:
Workspace:
* Generic library
* Application Code
* Library overriding Application specific code, where all the extensions / additions reside.
Scheme:
Created a scheme for the workspace, with following settings:
* Application Specific library with Generic library added as a dependent build
* Application Code having BOTH libraries added as dependent.
It works Wonders!!! :)

Related

Create an App within an App

I am being presented with a very interesting project. The task that I must complete is to figure out a way to allow a partner to be involved in an app without giving up their source code. The code will be included in the main bundle of the app so it is not dynamically stored. The partner has a fully functional app that is needed to be ran in a window within the main app at the appropriate time. I know having the partners create a web app would be ideal so it is treated like a webpage but I am more concerned with codes that must be written natively in iOS.
My question is what is the best way to go about solving this? In theory it is like an App within an App. Is there a way if they gave up their .app file I can include this in the bundle and then run it when I catch a certain event? Should I have the partners create their code in a framework and then import into the shell project? What is the best way to approach this problem?
If your 2nd-party doesn't want to provide you with the source code, why doesn't he compile it to object code then let you simply link it to your app?
By the way, at least on official (non-jailbroken) iDevices, apps can't 'embed' or 'open' one another in such a way - you can open an app programmatically if 1. it's a separate app 2. it has a registered special URL associated to its bundle.
Is there a way if they gave up their .app file I can include this in
the bundle and then run it when I catch a certain event?
No, you'll want to have them create a library instead. You can then include that library in your project.
Creating a library is as simple as:
Choose File->New...->Project... in Xcode.
Select the "Cocoa Touch Static Library" project template.
Add your code.
Build.
The result is a static library that you can add to your application(s). The library will contain the compiled code that you added, but doesn't include the source code. The library developer should provide whatever header files are necessary to use the code in the library.
An App within an App is possible however it requires a common data framework that allows one app to reference the same data without confusing the the source of and destination of the data.
Such a framework allows one app to interact with another app referencing the same data.

Migrate custom Facebook util library to Yii framework

I have a facebook app developed in plain PHP, I'm migrating the app to YII framework.
The thing is that I use a class call "utilsFacebook" where I have the object facebook(of the fb sdk) and all the methods that I need to get data from facebook, getUserId, getUserFriendList, etc.
I don't know how to handle all the operations that I do in utilsFacebook with Yii.
Create a controller with the functions of utilsFacebook is the correct think to do?
Every time that I instance the controller would create a new Facebook object, Should I store that object in a SESSION to get a better performance or is a bad idea?
Q. Create a controller with the functions of utilsFacebook is the correct think to do?
Having done a facebook app using yii as the framework, i would recommend you to make this library either a component, or an extension.
But definitely don't put these functions in the controller directly. Whenever a controller needs them call the functions using your custom facebook util class.
Components can be put in the folder: projectrootfolder/protected/components
Extensions can be put in the folder: projectrootfolder/protected/extensions
If you don't believe that either of these make semantic sense, you can always create a new folder within protected, say utils and put the class there. However i think extensions is the best way to go.
Q. Should I store that object in a SESSION to get a better performance or is a bad idea?
I don't think it's necessary to store the object in a session, because there will be no visible performance gain. Further you'll complicate your code unnecessarily.
What i had done was, created an app level component and used this component throughout the app, in any controller.
Example:
In your application's config, protected/config/main.php :
'components'=>array(
'fbHelper'=>array( // gave the component this name
'class'=>'ext.utils.FacebookHelper', // had stored the helper class in extensions/utils folder
'parameter1'='somevalue',
// more parameters
),
// standard yii app components
),
This will allow you to use the component like this: Yii::app()->fbHelper->getFriends();
Take a look at the facebook-opengraph extension, which could help you, on the way.

NServicebus MessageHandlers in a different Project don't get hit

My problem:
I have web project which implements NServicebus and should listen to messages.
Trying to keep my solution tidy I set up a different project for all my messagehandlers.
I now find that these messagehandlers do not get "hit" with messages.
To my understanding NServicebus scans all dll's in the debug folder of the web project to find any classes implementing IHandleMessages<>.
I referenced the messagehandlers class library project in my webproject and it appears in my debug folder, however it does not seem to get hit.
What does work
In a console sample project the inclusion of a referenced project which contains messagehandlers works as expected.
In my web app it works when I move my
messaghandlers to the web app project itself.
Reading through the website http://docs.particular.net/nservicebus/hosting/nservicebus-host/ I found that there are overloads for the Configure.With() method.
However:
I do not know if I need them. They text only seem to suggest that
this will limit the places where NServicebus looks for the
implementations of the interface.
these overloads do not exist in the Configure.WithWeb method which I'm using.
I can solve my problem by moving all the messagehandlers to my web project, but this does not seem like the best solution.
Am I missing something here?
When using NServiceBus in a web project, use NServiceBus.Configure.WithWeb() instead of NServiceBus.Configure.With().
Also, in order to load message handlers in a web application, you need to include the .LoadMessageHandlers() line after .UnicastBus() as described in Hosting NServiceBus in your own Process. Otherwise any IHandleMessages<T> implementations are not loaded and your web application operates as a send-only endpoint.

one code base for iphone generic application?

I have built a generic application which can handle different content data - but for each content data, it will be a different iphone application (with a different name).
I would like of couse to only keep one code base for all these different apps (as it would be easier maintenance) but I have 2 questions:
1- I would need to change the appname in the buildsettings, etc.. and may be it is going to be an overkill...? especially with the upload process then...? What are your experiences in that domain and what would you recommend me to do?
2- how can I have all the pictures for logo (Icon.png, etc...) to co-exist into one app? For the moment, I have a global variable (as a singleton pattern) that I switch to change appname and loaded data inside the program
Thanks in advance for your help
Cheers,
geebee
You can do this pretty easily, it's what most developers do in their lite versions. All you have to do is add another target to create a new app out of the same code and use that global variable.
In order to change the images included in the app you simply edit the target and under the copy bundle resources menu remove the unnecessary resources. You'll notice that when you add a new resource you have the option to include it in any one or more of your targets. Simply select the one that you want and it will only be accessible to that target.
The reason that this works is that each target can have its very own info.plist. All the settings and resources can be separate, and the code can be different using your #ifdef global_var.
Here's a slightly outdated tutorial that should get you started if you need it.
http://www.bit-101.com/blog/?p=2098
For each application name add one target.
Create one xyz-info.plist for each of the target. (in this case for the xyz.app)
In each of the xyz-info.plist assign the appropriate icon files etc.
Within your build phases for each of the targets you will define which images go with which app.

Equivalent to R in iOS

In android we have the R class that stands for Resources, where we have references to all of our resources and we can easily access them in the code. Is there an equivalent in iOS? I have this doubt because, I want to be able to define multiple files with different values, for instance:
DefaultValuesForViewController1
DefaultValuesForViewController2
Besides creating plist, is there another way (faster and easier like R)?
There is no R class equivalent access method.
In Android, the R class represents access to resources that are consolidated into a native format. iPhone does not do this. Instead, resource files are just copied as is into the application bundle and must be found & opened as such.
You could create a class to store all of your data for the app. iOS generally likes the app to run lean and mean, so only storing your objects for as long as you need them, releasing them as soon as you are done with them. If you were to store everything globally, it would add some overhead, but assuming you don't have a ton of information, it shouldn't be an issue.
There is no equivalent for this in iOS apps. All you get is files that you can enumerate using standard file I/O.
However, you can emulate it partially. Here's a simple demo on GitHub
You can find that SwiftGen(e.g. Tuist used it) can be used as an alternative for autogenerated R.java file on Android
Two point
it is third party source
you have to manually run script after changing your resources