{"id":788,"date":"2020-03-16T18:27:34","date_gmt":"2020-03-16T18:27:34","guid":{"rendered":"https:\/\/dev.i-smartcloud.com\/?page_id=788"},"modified":"2020-03-16T18:28:55","modified_gmt":"2020-03-16T18:28:55","slug":"rainbow-ios","status":"publish","type":"page","link":"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/","title":{"rendered":"Rainbow"},"content":{"rendered":"\n<p>We can not use the Rainbow SDK without first creating an instance of the Rainbow class. That class is so important that it exists as a singleton:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Rainbow *rainbow = [Rainbow instance];<\/code><\/pre>\n\n\n\n<p>Once we have that instance, we then need to pass the appSecret and a filePath:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[rainbow setAppSecret:{secret} andFilePath:{path}];<\/code><\/pre>\n\n\n\n<p>We get the <strong>{secret}<\/strong> from this site, when we registered the app. The <strong>{path}<\/strong>  is used to store the connected Cloud Service accounts. It may be an empty string, but in this case your users will have to connect to their accounts every time they start your app.<\/p>\n\n\n\n<p>The last step is to provide the keys for each Cloud Service. These are the clientID, clientSecret and callbacks that you put on a Cloud Service&#8217;s site. Each Cloud Service uses a different name for these keys, and thus we created the service.plist file in the demo code. You can remove the Cloud Services that you are not interested in or you can complete only those that you are. Once you have that file, create an NSDictionary from it and then call the method:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>NSDictionary *services = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@\"Service\" ofType:@\"plist\"]];\n[rainbow addServiceKeys:services];<\/code><\/pre>\n\n\n\n<p>Now we are ready to start using the Rainbow SDK.  Based on the non-empty values in the service.plist file, the method getServices will return the Cloud Services that you can use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(NSDictionary*)services = [rainbow getServices];<\/code><\/pre>\n\n\n\n<p>The key of that NSDictionary is the name of the Cloud Service, and the value is an instance of the <a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/service-ios\/\">RService<\/a> class. The name for each Cloud Service is the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Box<\/li><li>DropBox<\/li><li>GoogleDrive<\/li><li>IDrive<\/li><li>MediaFire<\/li><li>OneDrive<\/li><li>ShareFile<\/li><li>SkyDrive<\/li><li>SugarSync<\/li><\/ul>\n\n\n\n<p>If you use a different name you will get a nill object. Once you have the instance of the RService class, you can either list the connected accounts (<a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-ios\/\">RServiceItem<\/a> instance) or you can connect to a new account. From the RServiceItem instance you can get the <a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/cloud-manager-ios\/\">RManager<\/a> instance and then perform any of the supported action on that Cloud Service.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We can not use the Rainbow SDK without first creating an instance of the Rainbow class. That class is so important that it exists as a singleton: Once we have&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-788","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Rainbow - Rainbow SDK<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Rainbow - Rainbow SDK\" \/>\n<meta property=\"og:description\" content=\"We can not use the Rainbow SDK without first creating an instance of the Rainbow class. That class is so important that it exists as a singleton: Once we have...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/\" \/>\n<meta property=\"og:site_name\" content=\"Rainbow SDK\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-16T18:28:55+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/\",\"url\":\"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/\",\"name\":\"Rainbow - Rainbow SDK\",\"isPartOf\":{\"@id\":\"https:\/\/dev.i-smartcloud.com\/#website\"},\"datePublished\":\"2020-03-16T18:27:34+00:00\",\"dateModified\":\"2020-03-16T18:28:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dev.i-smartcloud.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Rainbow\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dev.i-smartcloud.com\/#website\",\"url\":\"https:\/\/dev.i-smartcloud.com\/\",\"name\":\"Rainbow SDK\",\"description\":\"The Rainbow Cloud Manager at your disposal\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dev.i-smartcloud.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Rainbow - Rainbow SDK","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/","og_locale":"en_US","og_type":"article","og_title":"Rainbow - Rainbow SDK","og_description":"We can not use the Rainbow SDK without first creating an instance of the Rainbow class. That class is so important that it exists as a singleton: Once we have...","og_url":"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/","og_site_name":"Rainbow SDK","article_modified_time":"2020-03-16T18:28:55+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/","url":"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/","name":"Rainbow - Rainbow SDK","isPartOf":{"@id":"https:\/\/dev.i-smartcloud.com\/#website"},"datePublished":"2020-03-16T18:27:34+00:00","dateModified":"2020-03-16T18:28:55+00:00","breadcrumb":{"@id":"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-ios\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dev.i-smartcloud.com\/"},{"@type":"ListItem","position":2,"name":"Rainbow"}]},{"@type":"WebSite","@id":"https:\/\/dev.i-smartcloud.com\/#website","url":"https:\/\/dev.i-smartcloud.com\/","name":"Rainbow SDK","description":"The Rainbow Cloud Manager at your disposal","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dev.i-smartcloud.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages\/788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/comments?post=788"}],"version-history":[{"count":10,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages\/788\/revisions"}],"predecessor-version":[{"id":800,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages\/788\/revisions\/800"}],"wp:attachment":[{"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/media?parent=788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}