iCloud external :-)
Maarten Koopmans
maarten.koopmans at gmail.com
Fri Aug 3 08:52:03 EDT 2012
Hi Willem,
Screenshots with iCLoud are next-to-near impossible, but here's some
code from handlers in my demo/test stack.
First, getting some basic information:
on mouseUp
answer "Trying to fetch basic app/team info, and so some setup"
put setupUbiquityDocumentsFolder() into tSetup
answer "Setting up ubiquity document url succeeded: " & tSetup
put getApplicationIdentifier() into tAppID
answer "App ID: " & tAppID
put getAppName() into tAppName
answer "App Name: " & tAppName
put getTeamPrefix() into tTeamPrefix
answer "Team prefix: " & tTeamPrefix
answer "Containerized name: " & containerize("my.com.SharedStorage")
end mouseUp
Next, publishing a file publicly via iCloud:
on mouseUp
answer "In as public file handler"
set the defaultFolder to specialFolderPath("documents")
answer "default folder set"
put "HelloCloudPublic.txt" into tLocalFilePath
open file tLocalFilePath for write
write "Hello iCloud!" to file tLocalFilePath
close file tLocalFilePath
answer tLocalFilePath
--Note that here we effectively use the FULL path... Different from
setUbiquitous
put asPublicCloudFile(tLocalFilePath) into tSharedURL
answer "Your public iCloud URL for the next two weeks is: " & tSharedURL
revMail "you at who.net","","miCloud link",tSharedURL
end mouseUp
And "the killer" - publishing a file in a shared storage container
(shared with other apps):
on mouseUp
answer "In make ubiquitous (1) handler"
set the defaultFolder to specialFolderPath("documents")
get setupUbiquityDocumentsFolder()
answer "default folder set, setup succeeded = " & it
put "HelloCloudUbiqOrLocal.txt" into tLocalFilePath
answer "Local file url: " & getLocalFileURL(tLocalFilePath)
open file tLocalFilePath for write
write "Hello iCloud!" to file tLocalFilePath
close file tLocalFilePath
--This is needed because our routines magically create the correct file path.
--Whereas LC on opening the file puts the full path into tLocalFilePath....
put "HelloCloudUbiqOrLocal.txt" into tLocalFilePath
--Check, check, double check
answer tLocalFilePath
--test and show that the file is local
answer "File is local: " & isLocal(tLocalFilePath)
-- get its file url
put getFileURL(tLocalFilepath) into tFileURL
answer "Local file URL = " & tFileURL
--make the file ubiquitous, 1= true, rest = false
get setUbiquitousForFile(1,tLocalFilePath)
answer "Set ubiquitous, done"
--test to see if it is local or ubiquitous (really, the result
coming back from iCloud in setUbiquitous is less trustworthy)--test to
see if it is local
answer "File is local: " & isLocal(tLocalFilePath)
--test to see if it is ubiquitous
answer "File is ubquitous: " & isUbiquitousDocument(tLocalFilePath)
--get the file url, again (should be ubiquitous now...)
put getFIleURL(tLocalFilepath) into tFileURL
answer "Now... Ubiquitous file URL = " & tFileURL
--get the modification date
answer "modification data = " & getModificationDateForURL(tFileURL)
--list the documents container contents
answer getContentsOfUbiquityDocumentsFolder()
--delete the ubiquitous document instance
get setUbiquitousForFileInContainer(0,tLocalFilePath,tContainer)
answer "Remove ubiquitous, done"
--at this point the file is only local...
end mouseUp
Doe this wet your appetite(s)?
Cheers,
Maarten
On Fri, Aug 3, 2012 at 2:31 PM, William de Smet <williamdesmet at gmail.com> wrote:
> Hi Maarten,
>
> I am very much interested in this Cloud external.
> Do you have any information and screenshots online already?
>
> groeten,
>
> William
>
>
> 2012/8/3 Maarten Koopmans <maarten.koopmans at gmail.com>:
>> Folks,
>>
>> I have spent a lot of time on it over the last two months, but I
>> finally have an iOS iCloud external working. One of the things I've
>> learned is that iCloud works (by itself), but it is very easy to make
>> a mistake - hence the apps that behave so badly with iCloud.
>>
>> Anyway, the external can:
>>
>> - give back your app name, team prefix, bundle identifier
>> - put files in your app's container
>> - manipulate and query the apps container (evict files, force
>> download, modification dates, list files...)
>> - put files in a shared container across apps - so you have shared
>> data across iOS apps [ yes ... that's right!!!]
>> - manipulate and query the shared container
>> - put files in a container or shared container up for download for two
>> weeks [ yes, you read this correctly as well....]
>>
>> I can do two things:
>> 1) continue with my main project as I will eventually
>> 2) spend even more time and put the external up for sale for $49
>>
>> As this really has been a LOT of work I don't want to put something up
>> for sale if nobody is interested, so consider this a poll. Personally,
>> I find the shared storage across apps and public data publishing is
>> pretty awesome.
>>
>> Let me know if you're interested - otherwise I'll simply enjoy my weekend ;-)
>>
>> --Maarten
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list