Posts

Showing posts with the label ios

How to exclude Firebase Messaging from Unity iOS builds, but not Android builds

Image
Clash Royale CLAN TAG #URR8PPP How to exclude Firebase Messaging from Unity iOS builds, but not Android builds I have a Unity project that builds for both Android and iOS. I want to integrate Firebase on my Android builds, but not for my iOS builds. Is there a way to exclude Firebase Messaging from the iOS builds completely, but keep it in for Android? I don't see the options to do so in the Firebase settings panel. I tried to unselect the Editor/iOS parts of the unity package when installing it, but I still get linker errors (when building my iOS app in Xcode) that reference missing Firebase directories. Thanks in advance, - cg By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Force the navigation bar to add space for the status bar

Image
Clash Royale CLAN TAG #URR8PPP Force the navigation bar to add space for the status bar I have a UIPageViewController subclass that allows the user to swipe upward from the initial view controller to a second view controller. The initial view controller does not have a navigation bar (it's not connected to a UINavigationController ), but the second one does. Currently, when I swipe up to present the second view controller, there is no space in the navigation bar for the status bar. When the transition is complete, the entire view controller layout updates instantly to add the status bar space. I want to make the second view controller anticipate that the status bar will be there and add the space for it so the view doesn't jolt after the transition. UIPageViewController UINavigationController Short video clip showing the jolt Similar, but unanswered question EDIT: After closely looking at the way the view controller behaves during the transition, I was able to get a good l...

How to enable alert in iOS Safari?

Image
Clash Royale CLAN TAG #URR8PPP How to enable alert in iOS Safari? I have some alert dialog using Javascript. I found when using Safari browser under iOS, it was disabled. I am wondering if this is the standard behavior of Safari and how to enable the alert? which version of ios, safari. Give more details. Whats your code like, is it compiled to js or is it raw js ? – WilomGfx 8 mins ago JavaScript and Java are different my dude. Check your tags – Jacob B. 7 mins ago By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privac...

How to encrypt/decrypt a data using Elliptic Curve Cryptography(ECC) using the Bouncy Castle Open Source Library for iOS Swift

Image
Clash Royale CLAN TAG #URR8PPP How to encrypt/decrypt a data using Elliptic Curve Cryptography(ECC) using the Bouncy Castle Open Source Library for iOS Swift How can I encrypt and decrypt a data using Elliptic Curve Cryptography(ECC) using the Bouncy Castle or Spongy Castle Open Source Library for iOS Swift. You can try cryptoSwift library for encryption/decryption. github.com/krzyzanowskim/CryptoSwift – Smita Dec 27 '17 at 10:28 CryptoSwift not supporting Elliptical Curve Encryptions – Ajithkumar M Dec 27 '17 at 10:48 Bouncycastle is for Java and c#, not for iOS – pedrofb ...

How to display 3 cells per row in UICollectionView?

Image
Clash Royale CLAN TAG #URR8PPP How to display 3 cells per row in UICollectionView? I used a custom flow layout according to this post. Here is my implementation: @implementation CustomLayout -(void)prepareLayout{ [super prepareLayout]; // [self invalidateLayout]; if(self.collectionView){ CGSize newItemSize=self.itemSize; // Number of items per row int itemsPerRow=3; float totalSpacing=self.minimumLineSpacing*(itemsPerRow-1); newItemSize.width=(self.collectionView.bounds.size.width -totalSpacing)/itemsPerRow; if(self.itemSize.height>0){ float itemAspectRatio=self.itemSize.width/self.itemSize.height; newItemSize.height=newItemSize.width/itemAspectRatio; } [self setItemSize:newItemSize]; } } @end This is what I've got: What did I miss? I've come across some other SO posts but no luck so far. 4 Answers 4 Swift 3.0. Works for both horizontal and v...

Image Encryption in Swift

Image
Clash Royale CLAN TAG #URR8PPP Image Encryption in Swift I am using IDZSwiftCommonCrypto for image encryption using StreamCryptor described as an example at its GitHub page: https://github.com/iosdevzone/IDZSwiftCommonCrypto IDZSwiftCommonCrypto I am not able to successfully decrypt. Here is my code for encryption and decryption (imageData comes from UIImageView ). The output is different from input after encryption (imageData is different from xx). UIImageView Encryption: func performImageEncryption(imageData: Data) -> Void { var inputStream = InputStream(data: imageData) let key = arrayFrom(hexString: "2b7e151628aed2a6abf7158809cf4f3c") var sc = StreamCryptor(operation:.encrypt, algorithm:.aes, options:.PKCS7Padding, key:key, iv:Array<UInt8>()) var inputBuffer = Array<UInt8>(repeating:0, count:1024) var outputBuffer = Array<UInt8>(repeating:0, count:1024) inputStream.open() var cryptedBytes = 0 ...

How to disable isEnable and isUserInteraction attributes but keep cursor show in UITextField?

Image
Clash Royale CLAN TAG #URR8PPP How to disable isEnable and isUserInteraction attributes but keep cursor show in UITextField? I have a custom framework for UITextField . For now, I want to disable two attribute as the question above but still keep the cursor show in my custom textfield. I already disable the keyboard with set the inputView = UIView() , and that successful for hide the keyboard even show the cursor inside textField. UITextField inputView = UIView() My goal is disable both attributes like above or another for can not Select All action from my textField, but still keep the cursor available anytime. Select All Hope to hear the ideas from you guys. Thank a lot! Put a dummy view above textview with clear color, and show and hide that view. – Bista 31 secs ago By ...

how to call a swift function from javascript

Image
Clash Royale CLAN TAG #URR8PPP how to call a swift function from javascript I am injecting a script in UIWebView using Swift. When a certain tap action happens, the script takes care of the handling. While this happens, the JavaScript is supposed to make a call to one of the functions in Swift, which saves the data sent from JavaScript in native variable. Please help me in making this call. UIWebView People won't be able to help without showing what you have done so far. Bits of code snippets would do. – Jay Mayu 27 mins ago 1 Answer 1 For this you need to make a callback from your JavaScript file, I used one JavaScript editor in that,This was the code :- window.location = "callback://0/"+ pass your value here And in your swift file, use t...

not able to understand that how to store value in userdefaults

Image
Clash Royale CLAN TAG #URR8PPP not able to understand that how to store value in userdefaults i am new to swift and i want to know that from my response i want to store user id in userdefaults please any one help data = { "access_token" = b332236bb2c9a2a5e35452bff62f76ac; "contact_no" = 847334868; email = "jhdsjhs@gmail.com"; "fk_user_id" = 125; "is_active" = 1; photo = "usr_jbdcm1533033074.png"; "user_name" = schsjcsacksjah; "user_role" = 2; "user_type" = 0; }; message = "Customer registered successfully!"; success = 1; } i want to store fk_user_id in user defaults please can anyone help Are you able to fetch fk_user_id from your response ? Saving it is just one search and one click on google. – Sharad Chauhan 9 mins ago ...

Swift Custom NavBar Back Button Image and Text

Image
Clash Royale CLAN TAG #URR8PPP Swift Custom NavBar Back Button Image and Text I need to customise the look of a back button in a Swift project. Here's what I have: Here's what I want: I've tried creating my own UIBarButtonItem but I can't figure out how to get the image to be beside the text, rather than as a background or a replacement for the text. let backButton = UIBarButtonItem(title: "Custom", style: .Plain, target: self, action: nil ) //backButton.image = UIImage(named: "imageName") //Replaces title backButton.setBackgroundImage(UIImage(named: "imageName"), forState: .Normal, barMetrics: .Default) // Stretches image navigationItem.setLeftBarButtonItem(backButton, animated: false) @Randy You mean make a UIView and add a Label and ImageView and set that? – Conor May 31 '16 at 18:25 ...

2 UiDatepickerView in one ViewController

Image
Clash Royale CLAN TAG #URR8PPP 2 UiDatepickerView in one ViewController I want to use 2 UiDatePickerView in 1 One View Controller. I used 2 textfields fromeDate to toDate but when i selected fromdate textfield it automatically selected other toDate. I want to know who can i use 2 or more Uidatepickerview in 1 view controller This is my code: @IBOutlet weak var fromDateTxtField: UITextField! @IBOutlet weak var toDateTxtField: UITextField! private var datePickerFrom: UIDatePicker? private var datepickerTo : UIDatePicker? override func viewDidLoad() { super.viewDidLoad() datePickerFrom = UIDatePicker() datepickerTo = UIDatePicker() datePickerFrom?.datePickerMode = .date datepickerTo?.datePickerMode = .date fromDateTxtField.inputView = datePickerFrom toDateTxtField.inputView = datepickerTo showDatePicker() } func showDatePicker(){ datePickerFrom?.datePickerMode = .date let toolBar = UIToolbar() toolBar.sizeToFit() let doneButton = UIBarButto...

How to change UITableView Label to mutiple color

Image
Clash Royale CLAN TAG #URR8PPP How to change UITableView Label to mutiple color How do I change the text in my UITableView to two different colors? let highest = (history[indexPath.row].highest!) //Red color let lowest = (history[indexPath.row].lowest!) //Green color cell.detailTextLabel?.text = "$(highest)/$(lowest)" return cell Thank you! use attributed text for this use two colors one for lowest and other highest – Vinodh 3 mins ago 1 Answer 1 You can prepare a custom view with two labels, one for highest, other for lowest. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your ...

How to return value from a Closure in Swift?

Image
Clash Royale CLAN TAG #URR8PPP How to return value from a Closure in Swift? So I am using fabric plugin/Twitter-kit to use twitter api in my application. I want to get the image URL of profile picture of a celebrity. here is my code below. func getImageURL(celebrity :String) -> String{ var imageURL = "" let client = TWTRAPIClient() let statusesShowEndpoint = userSearch let params = ["q": celebrity, "page" : "1", "count" : "1" ] var clientError : NSError? let request = client.URLRequestWithMethod("GET", URL: statusesShowEndpoint, parameters: params, error: &clientError) client.sendTwitterRequest(request) { (response, data, connectionError) -> Void in if connectionError != nil { print("Error: (connectionError)") } do { let json = try NSJSONSerialization.JSONObjectWithDat...

How do I pass indexPathForSelectedRow into a UITabView via a UITabBarController?

Image
Clash Royale CLAN TAG #URR8PPP How do I pass indexPathForSelectedRow into a UITabView via a UITabBarController? I'm trying to segue from a UITableView to a specific tab within a UITabBarController . While googling, I found two sets of info that seem to indicate how to do, but neither were using a UITableView as the source. UITableView UITabBarController UITableView The first source is this wonderfully written answer I found here on StackOverflow: How to make a segue to second item of tab bar? The second source was this site: http://www.codingexplorer.com/segue-uitableviewcell-taps-swift/ I have been attempting to combine the two for my app. Below is a truncated version of my originating UIViewController (I can post the full one if needed, just most the code isn't related to this segue, I don't think): class BonusListViewController: UITableViewController { // MARK: - Table View Configuration override func numberOfSections(in tableView: UITableView) -> Int { ...

I am developing react-native with Visual Studio Code. I have the following problems

Image
Clash Royale CLAN TAG #URR8PPP I am developing react-native with Visual Studio Code. I have the following problems When I'm doing 'react-native run-android' I'll have the following questions Scanning folders for symlinks in S:demoTestnode_modules (40ms) JS server already running. Building and installing the app on the device (cd android && gradlew.bat installDebug)... FAILURE: Build failed with an exception. What went wrong: A problem occurred configuring root project 'demoTest'. Could not resolve all files for configuration ':classpath'. Could not resolve com.android.tools.build:gradle:3.1.2. Required by: project : Could not resolve com.android.tools.build:gradle:3.1.2. Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.pom'. Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.pom'. Connect to 127.0.0.1:1087 [/127.0.0.1...