ios8-extension

How to include AFNetworking as a Framework for using in an iOS App and Extension via CocoaPods

心不动则不痛 提交于 2019-11-28 18:26:16
NB: This is related to this question on project structure, but I have decided to a vastly the use-case to better abstract the problem. Problem How do I include afnetworking in my iOS App and an accompanying iOS Extension ( ios8-extention , ios8-today-widget or ios8-share-extension ) via CocoaPods? Issues For use in Extensions, AFNetworking needs to be build with #define AF_APP_EXTENSIONS , does this mean I need 2 versions AFNetworking? One for the Extension and one for the App? How do I set up the Podfile so frameworks are built and copied to the correct places? Documentation on use_frameworks

Height of iOS8 Today Extension using Only Auto Layout Gives Broken Constraints

删除回忆录丶 提交于 2019-11-28 16:12:04
Apple documentation suggests setting the height of Today Extensions using autolayout. If a widget has additional content to display, you can rely on Auto Layout constraints to adjust the widget’s height as appropriate. If you don’t use Auto Layout, you can use the UIViewController property preferredContentSize to specify the widget’s new height. However, every example and tutorial I have seen ends up using preferredContentSize . All of my attempts to set the height via autolayout lead to warnings of broken constraints. Setting Height Via Autolayout I started with a fresh xcode template, and a

iOS Share vs Action App Extension

北战南征 提交于 2019-11-28 14:38:08
问题 I want to implement an app extension, but I can't decide if I should implement it as a Share Extension or Action Extension. The documentation doesn't say much about the differences, just this: Share (iOS and OS X) : Post to a sharing website or share content with others Action (iOS and OS X; UI and non-UI variants) : Manipulate or view content originating in a host app Are there technical differences as well (e.g. does an Action extension allow me to do something that the Share extension

Retrieve ALAsset or PHAsset from file URL

人盡茶涼 提交于 2019-11-28 12:13:34
Selecting images in Photos.app to pass to an action extension seems to yield paths to images on disk (e.g.: file:///var/mobile/Media/DCIM/109APPLE/IMG_9417.JPG ). Is there a way to get the corresponding ALAsset or PHAsset? The URL looks like it corresponds to the PHImageFileURLKey entry you get from calling PHImageManager.requestImageDataForAsset . I'd hate to have to iterate through all PHAssets to find it. I did what I didn't want to do and threw this dumb search approach together. It works, although it's horrible, slow and gives me memory issues when the photo library is large. As a noob to

Sharing code between original iOS App and App Extension

狂风中的少年 提交于 2019-11-27 22:44:11
Sharing class between iOS app and extension app I want to use a custom class in both my app and the extension app. If I just have the class in the main app folder, the extension doesn't pick up on it. I tried making a copy of it and putting it into the extension folder, but I of course get a invalid redeclaration of [my class] error. What's the best solution for this? It's just one class, not multiple resources. Nothing should be copied. Just add required files to compile sources for your extension: Just make sure that the files you want to share gets a tick in the section Target Membership .

How to include AFNetworking as a Framework for using in an iOS App and Extension via CocoaPods

一曲冷凌霜 提交于 2019-11-27 11:33:19
问题 NB: This is related to this question on project structure, but I have decided to a vastly the use-case to better abstract the problem. Problem How do I include afnetworking in my iOS App and an accompanying iOS Extension (ios8-extention, ios8-today-widget or ios8-share-extension) via CocoaPods? Issues For use in Extensions, AFNetworking needs to be build with #define AF_APP_EXTENSIONS , does this mean I need 2 versions AFNetworking? One for the Extension and one for the App? How do I set up

Retrieve ALAsset or PHAsset from file URL

十年热恋 提交于 2019-11-27 06:50:52
问题 Selecting images in Photos.app to pass to an action extension seems to yield paths to images on disk (e.g.: file:///var/mobile/Media/DCIM/109APPLE/IMG_9417.JPG ). Is there a way to get the corresponding ALAsset or PHAsset? The URL looks like it corresponds to the PHImageFileURLKey entry you get from calling PHImageManager.requestImageDataForAsset . I'd hate to have to iterate through all PHAssets to find it. 回答1: I did what I didn't want to do and threw this dumb search approach together. It

Swift apply .uppercaseString to only the first letter of a string

故事扮演 提交于 2019-11-27 06:02:25
I am trying to make an autocorrect system, and when a user types a word with a capital letter, the autocorrect doesn't work. In order to fix this, I made a copy of the string typed, applied .lowercaseString, and then compared them. If the string is indeed mistyped, it should correct the word. However then the word that replaces the typed word is all lowercase. So I need to apply .uppercaseString to only the first letter. I originally thought I could use nameOfString[0] but this apparently does not work. How can I get the first letter of the string to uppercase, and then be able to print the

Swift apply .uppercaseString to only the first letter of a string

巧了我就是萌 提交于 2019-11-26 22:15:16
问题 I am trying to make an autocorrect system, and when a user types a word with a capital letter, the autocorrect doesn't work. In order to fix this, I made a copy of the string typed, applied .lowercaseString, and then compared them. If the string is indeed mistyped, it should correct the word. However then the word that replaces the typed word is all lowercase. So I need to apply .uppercaseString to only the first letter. I originally thought I could use nameOfString[0] but this apparently

Add “Edit in Excel” or “Edit photo” extension

别来无恙 提交于 2019-11-26 09:56:17
问题 I checked the latest Dropbox and Excel for iOS. In Dropbox we get an edit button. On click it opens Excel\'s extension where you can edit the file. After save, changes are reflected in the Dropbox file too. I want to add such a button. Also I\'d like to add such a button to images to open them in available \"photo editing\" apps. How to check if file (image, xls, doc or any other) can be opened to edit? Code so far: UIDocumentPickerViewController *documentPicker = [