Is there a proper way to request a swift file from a server, and use it functionally in your project in real-time? By possibly adding it to your bundle temporarily?
If you are asking if it's possible to download a Swift file from a server, and run it on your iOS/iPadOS/watchOS/etc app, the answer is no. Even if you found a way, it would be rejected under rule 2.5.2 of the App Store Review Guidelines, which states:
Apps should be self-contained in their bundles, and may not read or
write data outside the designated container area, nor may they
download, install, or execute code which introduces or changes
features or functionality of the app, including other apps.
Educational apps designed to teach, develop, or allow students to test
executable code may, in limited circumstances, download code provided
that such code is not used for other purposes. Such apps must make the
source code provided by the Application completely viewable and
editable by the user.
Highlight mine.
Related
App Store Review Guidelines says: "Apps that download code in any way or form will be rejected."
I'd like to make an app using Challenge-Response for authentication. The app has a set of basic algorithms such as SHA-1, SHA-256, MD5, DES, AES and so on. The challenge server makes contains an array of the algorithms' name with random arrangement and a string names A. Client uses the algorithms and the sequence that challenge indicates to manipulate string A, and returns it to the server as the response.
Although all I transfer between server and client is a bunch of strings, but they indeed change the behavior of my app. Should I consider them a form of code? If not, why downloading shell code to execute is forbidden by Apple? I mean, shell code is also a bunch of strings and interpreted by running environment. Where is the essential difference?
Forgive my English :)
What Apple is worried about and wanting to prevent is applications that get through the approval process (disguised as something benign) and later change their fundamental function.
An extreme example would be an application downloading new, malicious executable code after it has been installed on the user's device.
Apple is using broad wording in order to be able to reject any app that in any way tries to be harmful to the user. It would be impossible to specifically describe every technique and specific way this could happen, so Apple keeps the wording loose.
Apps "download code" in some form or another all the time, consider an application that accesses an API that returns JSON formatted responses. Technically that could be considered code, and it can change the apps behavior (which view to show, what options would be available on a certain view, etc). But an app that access an API in this manner would certainly not be rejected.
From what I can gather from your question, it sounds like you don't have to worry about that particular clause in the guidelines.
I check iOS document and also google it for a while and get the impression that iOS does not support samba (although there is a samba app for jailbreak iPhone).
But then how do the app FileBrowser achieves that? Does that mean they implemented samba support by their own ?
I also find there is an open source library called tango that provides limited support for samba. So my question is that the best samba support I can get ?
I spent quite some time in implementing my own SMB client so I would like to share some experience here.
First do not use tango in your production code because once you become familiar with SMB you will realize that its implementation is problematic, e.g. it does not support unicode and in some several cases it is not correctly padding so you can't access the folder. And I also heard people said they can't connect window 7 with it.
Second, to summarize my experience I find jcifs guys had said the best: "anyone who wants to implement the CIFS needs to know one very important thing - the "official" CIFS documentation is not accurate
and does not reflect reality. There is NO specification. Do not believe anything you read in the IETF draft or the SNIA document (same document different formatting). Use it only as a hint. The definitive reference is whatever you see on the wire.
WireShark Rules!
... look at JCIFS for design inspiration such as how it puts the request and response into a map by MID and encodes and decodes frames.
Then implement the following commands:
SMB_COM_NEGOTIATE
SMB_COM_SESSION_SETUP_ANDX
SMB_COM_TREE_CONNECT_ANDX
SMB_COM_NT_CREATE_ANDX
SMB_COM_READ_ANDX
SMB_COM_WRITE_ANDX
SMB_COM_CLOSE
all responses for above
"
The only thing I can add is that , you also need to implement TRANS2_FIND_FIRST2 request/response to query the files inside a folder and if you want to find out how many shared folders the server exposes you need to implement NetShareEnum Request/Response.
I used libsmbclient from samba package (http://www.samba.org) for SMB operations on iOS.
You can look on my project https://github.com/kolyvan/kxsmb (objective-c wrapper on libsmbclient). For now it supports a limited set of SMB operations. It mostly was designed for browsing local net and retrieving files from SMB shares.
iOS doesn't give you access to a filesystem that you may be used to. You can read and write files inside your own App's private area, but that's all. You could potentially implement another file system in your application, but you won't be able to use normal file operations.
I'd bet FileBrowser implements the protocol inside their app and implements a file system like layer on top of that for access. I'd guess you could either try to port an existing samba library or roll your own.
iOS does not have any APIs to work with SMB. However, SMB is currently documented by Microsoft and implementing it is not impossible (although not easy too). I've created a freeware project which contains most of what you need to handle SMB. See
https://sourceforge.net/projects/smb4ios/
I have created one static library in iPhone sdk, and I am worried that If I provide code to anyone in which static library is being used, then anyone can use static library. So Is there any way to restrict them by using library until they get license? I am new to licensing any library.
This is a problem you must solve by legal means, not by any technical solution.
Make sure to only give the library to people you trust, and if needed have them sign an agreement not to spread it.
Also ask yourself if it is worth the trouble. Is your code so unique that they can not find it elsewhere, or duplicate it themselves in a few days, using Google and stackoverflow alone?
As said by #PeyloW,
This is a problem you must solve by legal
means, not by any technical solution.
But there are some simple ways to "block the code": You can create a RAR or ZIP archive, encrypted with password, and after they get license, you can tell them the password.
If you want to "Bind" license to a "developer's computer", than you simply need something that you can bind. For example that can be the emulator's UDID.
you can generate a license for emulator's UDID, and only limit emulator development, while allowing unrestricted access for ARM code (on device)
so you can basically check for emulator UDID
check license file
if license file allows that UDID, run
if not then show a message etc
for development purposes, everybody needs emulator, so I guess limiting it is enough for you.
Personally, I would create a new static library, check your code coverage and copy in only the code used by the app consuming it. Or in other words, don't give away more than you need to.
Then, as someone mentioned in the comments, obfuscate the calls. Your library is going to be worthless without documentation if your calls have to be deciphered. Odds are that anyone that has the aptitude of deciphering what your calls mean probably has 80% of a white-room reverse-engineering of your code already done.
You can't really force a license upon your client at the final hour unless they agree to it. So even if you did try to force them to license your library, it might not even be valid to do so with the original agreement intact. I'd do damage control to the extent your time is worth and chalk this up as a learning experience. 5 months from now, you'll probably have that static library re-factored to something better anyway. And next time, you'll work that into your agreement.
If you provide the static library, no one can get back the code.
Do you have reservations in others using your static library also?
I have an iOS app which stores data in the local directory. I'd like to be able to sync this data between multiple devices running my app. Currently this is using core data, but I'd expect to have to change to some text-based file storage system to make syncing easier.
I was expecting the DropBox API would make this nice and easy, and that I could tell the API to simply sync the contents of my data folder on startup/save. However it seems the DropBox API is nothing more than a glorified way of uploading and downloading files.
Am I wrong on this assumption? Can the DropBox API actually make it easy to keep a folder full of text files in sync? If not, is there some other service or even advice you can give? Syncing is hard - I was hoping DropBox would make it easier.
Using /metadata, getting information about the contents of a folder couldn't be easier. All you need to do is check the modified date, and if it's different than yours locally, perform the appropriate action. It will also give you the metadata for any file contents, so you can pick out which files need to be uploaded / downloaded / added / removed as necessary.
Any more functionality than this would be very application-dependent; you can decide for yourself when and how you want to deal with differing files.
Dropbox API Documentation
Won't repeat since Andy has answered your question, thought you may also find this tutorial helpful:
http://www.nanaimostudio.com/blog/2011/1/20/how-to-synchronize-your-app-data-using-dropbox-api.html
Check out the new DropBox Sync API.
As ohho mentioned, there's the DropBox Sync API available now which I think will do what you mentioned (I haven't tried it personally, as I integrated support for Dropbox in my app using the earlier SDK, before this came along). This will probably suffice if you're just working with dropbox.
In my case I've been starting to add support for additional online storage ("Cloud") services to my app, and am finding that it's somewhat challenging to deal with the differences between them in how they handle various concepts like authentication, version, naming etc. For example Dropbox's API references files according to their path, whereas Box's API references files according to their file id (which has an associated path, but I believe remains the same if the file is moved). Then there's also all the issues of conflict resolution (aka merging) which come about when multiple clients try and sync conflicting changes to the server.
I've actually been recently considering starting an open source project to develop a library which can connect to all the major services, and provide an abstraction layer that papers over their differences, and also handles the syncing process for you. I've actually got some code already (which I haven't publicly released to date) but could use that to get the project started.
Would this be of use to you? Would you (or any others) be willing to participate in such an effort?
(note to mods: I realise this may be deviating somewhat off-topic - sorry about that. If you can recommend a more suitable forum to discuss this I'd be happy to take the conversation there).
There is a RSS feed that can be limited to one of the shared folders but it kind of filters events to keep volumes low.
Is it possible to embed git in the iPhone app? Only in a passive mode, i.e. to be able to read commit messages (with date and user) and diffs given some online git repository in order to present it in some readable table views?
I'm one of the co-authors of cocoagit, which is currently an unfinished implementation of the core git functionality in Objective-C. There has not been much activity in the last 6 months. Unfortunately, it is not far quite far enough along to do everything you need. We can read commits, and have preliminary support for cloning repos, but we can't do diffs yet. Geoff and I would both like to have more time to work on it again, but in the meantime, we would gladly welcome any contributions.
Alternatively, I second the recommendations of previous posters to consider using github, or building your own web service to provide the necessary data.
Git (the command-line client) has been ported to jailbroken iPhones.
It would be easier to write a webapp that generated iPhone specific formatted output. Anything is possible on the iPhone, but to get an App on it you have to pay the $99 to join the club and then run the gauntlet of the Approval Process. A web app doesn't have to be approved by anyone.
It would be possible if you could statically compile the required git functions into your executable. It would require cloning the repository to the device’s disk though.
I’m not sure what your use-case is, but using a hosted website such as GitHub, or making your own web service if that is not possible, would likely be more sensible.
Not sure if this github client for iphone would offer any pointers
http://github.com/schacon/igithub/
It is definitely possible. The BugBranch app does this. According to the about section of the app, it uses libgit2 and objective-git.
You've got a couple options:
1) Get git(1) cross compiling for ARM and the iPhone and then embed them.
2) Use Dulwich and write a small tool you can drive with NSTask that does what you need (don't link your code directly to this or copy their implementation -- it's GPL). This is likely easier than option 1.
3) Write a web server which does what you need and then have your iPhone client access this.
It really depends on what you're doing, why you're doing it, and what infrastructure you've already got set up which option will be the best. For instance, if you already have any sort of server component already (e.g. for push notifications) I would recommend option 3.