Sending orders from website to iOS app - ios

I try to explain as best as I can (and simplify a bit).
I have an iOS app, asking the user 5 questions, 1 to 5 in this order. The questions are inside the app and the answers are then sent to a server via AF networking. It all works well.
I want to develop a web site with these same questions so somebody can choose which questions to be asked and in which order, for example 2, 5 and 3 only and in this specific order. Of course it will vary with each user. I then need to send this information back to the app and I want it after that to be Internet independent. I mean the questions and order are sent to the app (downloading or uploading) but then the user doesn't need Internet anymore to answer the questions (if there is no Internet to upload answers to server, the answers are automatically already saved in my app).
This surely must be possible but I don't see how exactly.
Do I need to have the questions in my app (as now) or having them on the web site would be enough?
How do I tell iOS to do something from my web site?
...
I am not after a precise tutorial, just some ideas thrown together to get me started, please.
Thanks a lot in advance for your thoughts.

Do I need to have the questions in my app (as now) or having them on the web site would be enough?
It's a good idea to have them in the app, so if the app is first opened with no internet connection it will still be usable. Each time the app is opened it should try to get new data from the web service and update its internal store.
How do I tell iOS to do something from my web site?
Generally, you don't. The app checks at appropriate times (like each launch).
Based on your comment below, the app should ask the user for his details and that is the trigger to connect to the server and obtain the active questions and order information. This can then be stored locally and the question interface can be presented to the user. Note, you could also return the number of days that should be recorded from the server...
On the next launch, you check for the existence of stored active questions and order information, and if you have some you go direct to the question interface.
The user should be presented with an option to upload the results (at the appropriate time), and you should have a setting somewhere to clear everything (just to remove the data, but also if the user needs to 'login' with different details for a new test session - so the app will check with the server again).

Related

App rejected due to an IPV6 Swift3 error. How do I fix it?

A few days ago, Apple rejected my app, indicating that it didn't have IPV6 support, however I don't need that support since my app does not require internet access.
I asked the following:
Hi, my app does not need any internet connection yet.
So, why it's required to have support to IPV6?
They said:
Thank you for your response and for your question. In order to bring your app into compliance with Guideline 2.1 it would be appropriate for your app not to crash when logging in.
end
So, why do I need that Support?
If is necessarily, how do I can do it?
Please I need help
Test your app extensively and fix the crash. Enter wrong values, don't enter anything at all, intentionally try to break your app and get it to crash. Then you will find your error and you can fix.
EDIT BASED ON COMMENT BELOW
"My app don`t need conect with external database, because I got the information inside" - in this case, no, you do not need to add IPv6 support because you are not communicating with the internet for logging in purposes.
You can keep the login given it is only going to be 2 people using the app, just resolve the crash when logging in.
To test, enter a variety of incorrect passwords and usernames to ensure that there is no crash on incorrect entries, and confirm that correct entries do not crash the app.
Original Answer
Apple indicated that because there is a login feature, they think it is trying to communicate with an external database (ie a database that is not on the device). If there is no external database, just fix the crash is what they are asking.
Based on your question, you have eluded to the app not communicating externally for logging in. While some may find this odd, it is not uncommon. An example for those wondering would be a childrens app for iPad. The iPad might be shared amongst several children and as such each child might complete different sections or features of the app so an account local to the device is a good idea if there is no cloud support.
If there is external communication, you need to handle the case for no internet access. The question has been answered extensively, however this was the first result I found:
Detect Internet Connection and display UIAlertview Swift 3
Update: Why do I need to Support the case for no internet connection?
A use case:
John has just downloaded your app. He has just walked through the steps to create an account, but he has accidentally set his device to Aeroplane Mode.
John hits the "Create Now" button but nothing is happening. There is no error or success alert appearing, the screen has not changed, he can't see a loading icon. John is confused and getting frustrated because he's certain that he has completed everything in the form.
John doesn't understand that he needs internet connectivity to successfully submit a request to create an account. John decides to delete your app from his device and leaves a bad review.
John really could have used an alert saying "You need internet connection to sign up to this app. Please check you are connected and try again". This would have made John a whole lot happier and he probably would have continued to use your app with all of it's amazing features.
More information can be found in the guidelines that Apple mentioned, and further to this, the Apple Design Principles Guide is an invaluable resource.
I hope this makes sense.

How do I make a live text feed for announcements in my app? [duplicate]

This question already has an answer here:
How to send in-app announcements to people using my iOS app?
(1 answer)
Closed 7 years ago.
I would like to add a text feed to my iOS app. Basically, it would just be an updatable UITextView or UIScrollView that would display announcements/news (not an actual news or RSS feed though) on the home page. I want to be able to update this field remotely from my computer to give it a set number of messages/announcements to display one after another in a loop. I don't want to have to update the app to manually add them in via Xcode. I only know Objective-C.
How would I do this? I can't seem to find any tutorials for it. Maybe I'm just not searching in the right way. Can someone refer me to a guide or tutorial or even just a GitHub project I could implement? Thanks.
Edit: I see that a similar question has been asked after all, but I still don't understand the answer given. I'm still new to coding apps so I don't know how to use "initWithContentsFromURL." The person clearly knew what they were doing and so they did not get further explanation. Are there any good guides on how to implement this? I understand you would need to set up a website to store the data, but I'm not quite sure how you would do that. An example of the whole process of setting up the website to store this data and then retrieve it with the function would be helpful.
Look at push notification APN, there is a good tutorial for how to implement push notification
If the messages will only be displayed while the user is inside the app, there is no need for push notifications (which will also allow you to contact the user when the app is closed). The app can simply check with a remote server for the most updated content that needs to be displayed whenever the user launches the app (or whenever he/she enters the screen, or once a day - depending on how often you plan to update that info).

How can one app provide data to another without swiching apps?

Scenario:
I "control" two different apps, App A and App B, both which the user has installed
App A is running
App A needs to obtain a string that was set by App B when App B last ran.
After obtaining the string, App A will still be running
User should not receive any feedback this communication is happening. E.g. no "switching animations" between A or B, no pop-ups, etc.
Constraints:
Apps are released under different vendors
Apps are already in the app store; updated versions will have this communication ability.
It is acceptable for the data stored in App B to be accessible to other apps on the device.
It is not acceptable for the data stored in App B to be visible to general third parties (e.g. if an external server is used, there needs to be some sort of secured scheme)
The data read should be able to occur immediately upon App A being opened after install. For instance, I cannot require the user of App A to enter log in credentials for an external communication service.
Must work on non-jailbroken devices.
This is seeming rather difficult to pull off in iOS7. Help is appreciated.
Tricky work around. Not recommended, but it will get the job done if you can't afford servers.
On the first app create a contact in the user's contacts book. Give it a generic name like "000 - NameOfAppB Data - Don't Delete" (I start with "000" so it goes to the bottom of the users contact book so they never see it, I also add "don't delete" so if the user does somehow find it they don't delete it hahaha) (who looks at contact books anyways). In the contact info under notes add your NSData in string format.
Then when app A is opened search for that contact, read the data, then delete the contact.
Apple does allow you to create and delete users contacts without their permission. (At least in 2011 they did, this may have changed).
This might serve your purpose
https://developer.apple.com/library/ios/documentation/Security/Reference/keychainservices/Reference/reference.html
I am not sure of its limitations though, i have seen implementations where credentials have been shared between apps.

How do I push notifications if my app hasn't been run yet?

Assuming the user has not launched your app yet, but it has been run before. Is there a way to still "push" news/updates?
To explain what I mean:
Imagine the user installed "your-restaurants-in-your-area" local orientated app, and configured the app in some setting to notify the user when new restaurants open... However, the user forgets to run this app at a daily basis. Is there a way for the app to auto-show news inside iOS?
I have found this for XE4 where Anders is stying to help people get it working with XE4
http://blogs.embarcadero.com/ao/2013/05/02/39456
http://blogs.embarcadero.com/ao/2013/05/24/39472
After further searching (I missed this first round) I found this:
http://edn.embarcadero.com/article/43239
It requires editing Delphi XE4 bundled source files (i.e. so it is not officially supported / made easy in XE4), but it seems it can be made to work. (I have not found any official mention of official "built-in" support in XE5.)
I upvoted the answer given sofar since it was helpful in a way.
The question is not related to Delphi…
It is impossible to auto-run/unattended-run applications in iOS.
If the user has never opened your application, you will not able to send him “Push notification”, because your application must be registered with the token. Usually the application registers on the start.
Let’s assume the user launched the application at least once, and your application successfully registered the token for “Push notification”. In this situation, you will able to notify the user when the new restaurant will be opened.
The problem in this situation that you don’t know the physical location of the user. Maybe you can add the region of interests in your applications, so you will know to whom to send the notification.

How to share links via FB App when I am offline

I am developing an mobile app for iPhone. The app will primary used by people who are on holiday in a different country and will be offline most of the time, due to high costs for internet traffic.
However, the company for which I am developing the app wants to users to be able to use the "Facebook Share" functionality also when people are not connected to the internet.
It should work on a way that they click the SHARE link button in the app, but then get a message that they are offline and the link will get shared as soon as they are online again.
I am trying to figure out how to do this. Can I pass the link I want to share to the official FB App via fb:// protocol (or whatever) and the FB App handles the post/share as soon as it is online again?
Or do I have to do it on my own, put the links I want to share in a internal database and then post them to the wall when I am online again?
Or any other ways??
Any suggestions would be welcome, I would prefer a very quick solution and hope someone maybe has an idea how to do this. I was hoping I can pass the share-link to the official FB App and this one handles everything when it goes online again !?
Thanks for your ideas!
Your approach should be to make your link-sharing code automatically cache requests until they are sent. The app then doesn't need to concern itself with the details - it can just post the link and get a 'failed', 'success', or 'postponed' response from your API and notify the user accordingly.
Your link-sharing code can then internally check if it can currently post to FB and if not (either because the user is currently offline or perhaps the Facebook token is expired) it will store it for later. This class will then re-check periodically (for example when the app comes to the foreground or when the class is initialised the next time the app starts) for connectivity and then it will check if the token is still valid and perform FB login if required. Once it has a valid token it can then iterate through the pending requests and act upon them.
If you really want to make it nice and clean, you can separate out the code that accepts incoming requests to do something, checks if it can be performed now, does it or stores it for later, and periodically checks any requests in the pending queue. This class will not have any idea what the requests do or how they are performed, it will work with another class that implements a protocol to do the actual work and knows about facebook, etc. There may even be an existing design pattern for such a setup, but I don't know what it's called if there is.
Update: I did some research and found this is very similar to the "Fire-and-Forget Pattern".

Resources