How to create a global environment variable that can be accessed by SpringBoard or other applications in the jailbroken iPhone? - iphone

I found that a variable created in SpringBoard can not be accessed by other regular applications. But now I want to make a flag variable that can share status in the global environment efficiently.
I thought a file created at some path could do that, but that may be not fast enough.
Does any body know how to do this?

You can try combination of a file with notifications of changes in this file. Notifications between processes can be sent in two ways:
Darwin notification center CFNotificationCenterGetDarwinNotifyCenter
Distributed notification center CFNotificationCenterGetDistributedCenter - private API
Distributed notification center is better because you can send notification with some data attached to it. Darwin notification center ignores all user info passed to it. So when you changed some flag and saved it in a file you can send notification with this flag's new value. You don't even need to open file and get flag's value yourself. All other apps just need to listen for this notification.
Here is CFNotificationCenterGetDistributedCenter prototype
CFNotificationCenterRef CFNotificationCenterGetDistributedCenter();
Update:
This function is available in iOS 5.0 and above. If you need to support older versions there are two solutions:
Darwin notification center
CFMessagePort - can transmit arbitary data.
If you really need to support older versions I suggest you using CFMessagePort. It's simple and flexible solution, well documented. If you having troubles with it you can always find working examples.

You can store your var in the keyChain, and make all app which wanna share it in one access group. Hope it help.

Related

How can Apple Watch listen to data change on iPhone?

Let's say the iPhone has a text field or any internal data, upon the data change, I want to push it automatically to the Apple Watch. I know I can use the share data. But that seems to require user to initiate the call (e.g. pressing a button) on the Watch. Is there a listener on the Apple Watch that I can use if there is a change in the shared data? Or there is way for the iPhone to automatically push data to the watch, and the watch just receive it and display it? Or any other way?
You can see this answer. MMWormhole seems a good way to communicate between App and its extensions (i.e. Watch App).
Hope this helped.

How to build a simple notification application as non-developer?

I want to build an iPhone app - the entire purpose of which is to send push notifications.
In this case it'd send one quote from a famous person a day. The interface would just be a preference screen where you can control what time of day you'd like the notification to be sent, so it's pretty bare bones.
I don't really have the development chops to write it from scratch so I was wondering if there's an ideal platform, app-builder, or whatever to create it with.
You might want to try www.elance.com
The application itself will be easy to implement. But the other part is the Pushing application which will be sending the messages.
Check this tutorial here, Programming Push Notification Service
You might not necessarily need push notifications; if your quotations can be stored on the device, you can show them using local notifications instead.

Pass image from an email to image viewer in Xcode

We have an iPhone app that can display an image dataset and pass it to an UIImageviewer - however we could do with a rough pointer. If the user was sent the dataset (image) via email as an attachment how could we pass that onto the app to be displayed. These are not regular jpeg/png/bmp images - more datasets which need to go through / use a set of libraries to be displayed.
You can launch an application if that application registers its own URL scheme. However, I'm not sure how you would embed your own scheme into an email attachment.
http://mobileorchard.com/apple-approved-iphone-inter-process-communication/
http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
On a related note, I've noticed that you have been asking a lot of questions regarding DICOMs and iOS devices, trying to develop your own app, because you have a particular (email-centric) workflow not supported by existing PACS. It seems like you've already developed your own app, so congratulations are in order. If at any time, you decide that it may be more trouble than its worth, feel free to check out ours.
http://nephosct.com
Currently we bootstrap off of OsiriX as our server, but that should be fixed when we release a platform independent version (hopefully within a week). We would also be happy to work with you to add features to the app so that it supports your daily workflow.

reading a file saved by another app in iphone

Is there a way to have an app write a into a file and then have another app read from that file?
I mean writting into the file system of the iPhone.
I want to do this without using an internet connection. So uploading the file and then downloading from the other app is not what i mean.
Thanks!
It appears that there are ways you can, but it won't get approved by Apple if you do.
See http://blogs.oreilly.com/iphone/2008/09/sandbox-think-like-apple.html for more information.
The current sand boxing of applications does not allow this, however it appears that this may be available in future iPhone OS versions. Reference
I'm not sure exactly what circumstances you're in here, but you could register app B as a handler for a particular protocol, and have app A try to open such a link (e.g. appB://yourinfohere). It depends on how much data you want to transfer and many other things, but it might work.

iPhone gui message from perl/shell-script possible?

I want to write a perlscript on my iPhone that is able to give me a heads up at certain points so I'm wondering how I would go about doing that.
Is there a way to get a message through the gui from a script running in the background? I've been looking without much luck. I had a thought about inserting a fake sms into the sqlite db as a last resort but it seems somewhat unlikely that it would work.
It would be nice to be able to make a push notification style popup appear but that might too much to ask.
Any ideas?
For reasons of security and stability, Apple does not allow scripting languages on the iPhone. You can run them on a jailbroken phone but I'm given to understand it's a hassle.
From the Apple Push Notification Programming Guide:
Note: On a desktop system, a
background process is often the means
whereby users are informed of
downloadable data for an application
that currently isn’t running. But on a
device such as the iPhone, background
applications are, for performance and
security reasons, prohibited. Only one
application may be executing at a
time.
The iPhone is a secure and reliable phone first and a computer second. Computing is sacrificed to ensure a reliable phone.
I found a solution I liked so I decided to share it. I found an app for jailbroken iPhones called GriP - Growl for iPhone. Which changes the way push notifications and other messages are handled. It also makes it possible to send messages from the command line via something along the lines of:
/usr/bin/GriP -t "Title" -d "Description"
It has worked great so far.
Thank you for your help TechZen and molecules.
Do you want information from your phone itself or from an outside source? If you want information from an outside source, you could set up a Perl script on a computer to e-mail yourself notifications (see Sending Email with Perl Best Practice).