Posts

Showing posts with the label Ios

Adjusting The Xcode IPhone Simulator Scale And Size

Image
Answer : With Xcode 9 - Simulator, you can pick & drag any corner of simulator to resize it and set according to your requirement. Look at this snapshot. Note: With Xcode 9.1+, Simulator scale options are changed. Keyboard short-keys : According to Xcode 9.1+ Physical Size ⌘ 1 command + 1 Pixel Accurate ⌘ 2 command + 2 According to Xcode 9 50% Scale ⌘ 1 command + 1 100% Scale ⌘ 2 command + 2 200% Scale ⌘ 3 command + 3 Simulator scale options from Xcode Menu : Xcode 9.1+: Menubar ▶ Window ▶ "Here, options available change simulator scale" ( Physical Size & Pixel Accurate ) Pixel Accurate : Resizes your simulator to actual (Physical) device's pixels, if your mac system display screen size (pixel) supports that much high resolution, else this option will remain disabled. Tip : rotate simulator ( ⌘ + ← or ⌘ + → ), if Pixel Accurate is disabled. It may be ena...

"Connect Via Network" Wireless Debugging Not Working Xcode 9

Image
Answer : I was having the same issue and performed the following steps to get things working: Open "Devices and Simulators" Connect your device and check the "Connect via network" checkbox Disconnect your device Right click listing for your device in the left hand column (Under Disconnected) Select "Connect via IP Address.." and enter your device's IP address After numerous Wi-fi resets and device restarts (for iOS 12, Xcode 10) I found the solution for me was: Disconnect iOS device from Mac Go to Settings -> Develop on the iOS device Tap "Clear Trusted Computers" Reconnect iOS device to Mac via cable On iOS device tap "Trust This Computer" and enter passcode Go to Device Manager in Xcode and enable "Connect Via Network" The network symbol appeared and I was good to go.

Adding Custom Fonts To IOS App Finding Their Real Names

Image
Answer : Use +[UIFont familyNames] to list all of the font family names known to the system. For each family name, you can then use +[UIFont fontNamesForFamilyName:] to list all of the font names known to the system. Try printing those out to see what name the system expects. Example code: static void dumpAllFonts() { for (NSString *familyName in [UIFont familyNames]) { for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) { NSLog(@"%@", fontName); } } } Put that in your app, call it, and see what you get. If you see a name in the output that looks appropriate for your font, use it. Otherwise, perhaps you haven't properly added the font to your app. In swift 4.2+ use code given below: func dumpAllFonts() { for familyName in UIFont.familyNames { for fontName in UIFont.fontNames(forFamilyName: familyName) { print("\(fontName)") } } } ...

Cordova Info.plist NSCameraUsageDescription Key Is Missing

Answer : NEW ANSWER: Since Cordova CLI 6.5.0 you can write in the info.plist directly by using the edit-config tag in the config.xml like this: <string>your usage message</string> </edit-config> But make sure you are using latest version of the plugins or values might be overwritten by the plugin variables. For localizations you can use the resource-file tag and InfoPlist.strings files like in this plugin (but you don't need the plugin, resource-file tag is supported from the config.xml) https://github.com/MBuchalik/cordova-plugin-ios-permissions OLD ANSWER: You can't write on the info.plist from the config.xml using the config-file tag yet (it's being worked on) Latest version of the camera plugin allows you to add the NSCameraUsageDescription when you install the plugin cordova plugin add cordova-plugin-camera --variable CAMERA_USAGE_DESCRIPTION="your usage message" Right now it's not possible to localize this string Here are...

Can't Change Custom Class Of UIButton To GIDSignInButton

Image
Answer : You should try assign GIDSignInButton not to the Button Object from the Object library but to the the View Object instead It's work for me. It will look like this using UIView instead of UIButton. That's because GIDSignInButton is a subclass of UIView, not UIButton. Add to the storyboard / nib a regular UIView and change it's class to GIDSignInButton instead. From google doc: Add a GIDSignInButton to your storyboard, XIB file, or instantiate it programmatically. To add the button to your storyboard or XIB file, add a View and set its custom class to GIDSignInButton. You can create UIButton and then on its action method you can write this code for signing via google: GIDSignIn.sharedInstance().signIn() It works for me, in this way you can customize UIButton according to your requirement and also perform signin by using google

Add Views In UIStackView Programmatically

Image
Answer : Stack views use intrinsic content size, so use layout constraints to define the dimensions of the views. There is an easy way to add constraints quickly (example): [view1.heightAnchor constraintEqualToConstant:100].active = true; Complete Code: - (void) setup { //View 1 UIView *view1 = [[UIView alloc] init]; view1.backgroundColor = [UIColor blueColor]; [view1.heightAnchor constraintEqualToConstant:100].active = true; [view1.widthAnchor constraintEqualToConstant:120].active = true; //View 2 UIView *view2 = [[UIView alloc] init]; view2.backgroundColor = [UIColor greenColor]; [view2.heightAnchor constraintEqualToConstant:100].active = true; [view2.widthAnchor constraintEqualToConstant:70].active = true; //View 3 UIView *view3 = [[UIView alloc] init]; view3.backgroundColor = [UIColor magentaColor]; [view3.heightAnchor constraintEqualToConstant:100].active = true; [view3.widthAnchor constraintEqualToConstant...

Can I Run IOS Emulator On Windows Using Android Studio Avd Manger?

Answer : No, it is not possible. Any iOS operations require Xcode. So either use an OSX virtual machine or use a mac. But from Windows, you won't be able to run an iOS emulator. Unfortunately it's impossible :( Flutter app can run on Android and IOS emulators with Android Studio, but ONLY on Apple machines (not Windows). So if you have Android Studio installed on Windows machine you won't have IOS emulator. This info isn't obvious in Android Studio documentation, but you can find more details in Flutter installation guide: macOS install (Flutter, Android Studio, emulators for Android and IOS) Windows install (Flutter, Android Studio, emulator for Android) So in your case the best way is to develop flutter apps on your Mac. In order to test your flutter app in iOS Simulator,you have to do the following installation procedures into your MacBook: Install Android Studio/Visual Studio and all the Flutter/Dart Plugins. Make Sure that your XCode vers...

Adding A Watch App To A Flutter IOS Application

Answer : Flutter doesn't support Apple Watch apps due to the fact that it lacks Bitcode support for iOS as discussed in this GitHub issue. You can track the state of Adding Bitcode support for iOS - Flutter GitHub issue, but currently it seems to have a low priority for the Flutter development team. looks like apple watch development is supported in flutter now. here is an example: https://github.com/magnatronus/flutter-watchtips

Accessing IOS Safari Web Inspector From Windows Machine

Image
Answer : It appears to require Safari 6, which has not been released for Windows. Regarding the unavailability of Safari 6 on Windows, Apple has stated "Safari 6 is available for Mountain Lion and Lion. Safari 5 continues to be available for Windows." I regularly use weinre . It basically runs a webserver that in turn acts as an inspector-enhanced proxy to browse webpages and websites. The inspector can be started by adding a script to your page or running a bookmarklet. weinre is a debugger for web pages, like FireBug (for FireFox) and Web Inspector (for WebKit-based browsers), except it's designed to work remotely, and in particular, to allow you debug web pages on a mobile device such as a phone. To install it, you will need NodeJS and NPM (included with NodeJS). You will also need a WebKit-based browser on the desktop/receiver end (Safari, Google Chrome, or Chromium). It should work on Windows, OSX, and Linux. Official page: https://people.apache.org/~p...

Apple - Can You Force A Mobile Site On Your IPhone To Show Full Desktop View?

Image
Answer : I don't think you can do this in Safari on the iPhone but you could use a 3rd party browser app. Many of those will let you set the browser agent. One browser I know does this is 'Atomic Web Browser'. This may not work in all cases as some websites may use other ways of determining which content to show, for example, some will detect the screen dimensions. I've tried this on my iPhone with Atomic Web Browser. Within the browser, I went to settings, 'Identify browser as' and selected 'Safari Desktop'. Then I went to nascar.com and tapped on the nascar logo. It showed me the desktop version of the page. I checked in mobile safari and doing the same indeed took me to a mobile version. An additional recommendation: the free Puffin browser in the App Store displays full websites. Google Chrome for iPhone is my daily driver for Stackexchange and it works wonderfully well both in desktop and mobile modes. Tap the menu button Reqest Desk...

Crashlytics Does Not Show Crashes

Image
Answer : Checked the following terms, Make sure Crashlytics SDK line is after all other 3rd-party SDK lines. (it needs to be last one called in your appDidFinishLaunching method.) Force a crash and then relaunch the app. Xcode must be disconnected to stop it from intercepting the crash report. To disconnect Xcode, follow the instructions here. If you're using [Crashlytics sharedInstance] crash]; to test crashing, make sure it's not in the appDidFinishLaunching method. These are already mentioned in support section, Here is additional ones - Check in organization -> Your App -> Missing dSYM, Is it showing any missing dSYM file if yes, Then do the following step Right Click on your archive -> Show in Finder -> Right click on file and click on Show package contents Right click on dSYM file - > Show package contents -> Contents -> Resources -> DWARF (Open in terminal) Run command dwarfdump --uuid "file name you saw there in dwarf folder" This w...

Convert NSData To String?

Answer : Objective-C You can use (see NSString Class Reference) - (id)initWithData:(NSData *)data encoding:(NSStringEncoding)encoding Example: NSString *myString = [[NSString alloc] initWithData:myData encoding:NSUTF8StringEncoding]; Remark : Please notice the NSData value must be valid for the encoding specified (UTF-8 in the example above), otherwise nil will be returned: Returns nil if the initialization fails for some reason (for example if data does not represent valid data for encoding). Prior Swift 3.0 String(data: yourData, encoding: NSUTF8StringEncoding) Swift 3.0 Onwards String(data: yourData, encoding: .utf8) See String#init(data:encoding:) Reference Prior Swift 3.0 : String(data: yourData, encoding: NSUTF8StringEncoding) For Swift 4.0: String(data: yourData, encoding: .utf8) I believe your "P" as the dataWithBytes param NSData *keydata = [NSData dataWithBytes:P length:len]; should be "buf" NSData *keydata = [NSData dataWithBytes:buf length:len]; sin...

Converting String To Int With Swift

Answer : Updated answer for Swift 2.0+ : toInt() method gives an error, as it was removed from String in Swift 2.x. Instead, the Int type now has an initializer that accepts a String : let a: Int? = Int(firstTextField.text) let b: Int? = Int(secondTextField.text) Basic Idea, note that this only works in Swift 1.x (check out ParaSara's answer to see how it works in Swift 2.x): // toInt returns optional that's why we used a:Int? let a:Int? = firstText.text.toInt() // firstText is UITextField let b:Int? = secondText.text.toInt() // secondText is UITextField // check a and b before unwrapping using ! if a && b { var ans = a! + b! answerLabel.text = "Answer is \(ans)" // answerLabel ie UILabel } else { answerLabel.text = "Input values are not numeric" } Update for Swift 4 ... let a:Int? = Int(firstText.text) // firstText is UITextField let b:Int? = Int(secondText.text) // secondText is UITextField...

Can I Install The "app Store" In An IOS Simulator?

Answer : This is NOT possible The Simulator does not run ARM code, ONLY x86 code. Unless you have the raw source code from Apple, you won't see the App Store on the Simulator. The app you write you will be able to test in the Simulator by running it directly from Xcode even if you don't have a developer account. To test your app on an actual device, you will need to be apart of the Apple Developer program. No, according to Apple here: Note: You cannot install apps from the App Store in simulation environments. You can install other builds but not Appstore build. From Xcode 8.2 ,drag and drop the build to simulator for the installation. https://stackoverflow.com/a/41671233/1522584

Can I Use CloudKit On Android Or Web-based App?

Answer : Yes you can. Apple provides CloudKit JS, specifically designed for web services. I don't know much about Android, but I'm pretty sure it'll be not a hard challenge to run JavaScript. Also CloudKit WebServices could be interesting for you. EDIT advice and discussion To give you an honest advice: Better use something "own". I currently work with a custom server on an AWS EC2 instance and am really happy. You could, for example, write a really simple server using Node.js and connect a Mongo DB NoSQL database. CloudKit is actually not more than this. This is really a simple task. I did this before and with some JavaScript experience and a few days Node exercises it is absolutely feasible; you'll write really nice servers very quickly. In the end, when dealing with more customers, CloudKit will be more expensive, actually. And if you, why ever, must move to a different service, you will have trouble with CK, because you are not able t...

AlamoFire Download In Background Session

Image
Answer : Update Based on this amazing tutorial, I have put together an example project available on GitHub. It has an example for background session management. According to Apple's URL Loading System Programming Guide: In both iOS and OS X, when the user relaunches your app, your app should immediately create background configuration objects with the same identifiers as any sessions that had outstanding tasks when your app was last running, then create a session for each of those configuration objects. These new sessions are similarly automatically reassociated with ongoing background activity. So apparently by using the appropriate background session configuration instances, your downloads will never be "in flux". I have also found this answer really helpful. Original answer From Alamofire's GitHub page: Applications can create managers for background and ephemeral sessions, as well as new managers that customize the default ses...

Copy To Clipboard Using Javascript In IOS

Answer : Update! iOS >= 10 Looks like with the help of selection ranges and some little hack it is possible to directly copy to the clipboard on iOS (>= 10) Safari. I personally tested this on iPhone 5C iOS 10.3.3 and iPhone 8 iOS 11.1. However, there seem to be some restrictions, which are: Text can only be copied from <input> and <textarea> elements. If the element holding the text is not inside a <form> , then it must be contenteditable . The element holding the text must not be readonly (though you may try, this is not an "official" method documented anywhere). The text inside the element must be in selection range. To cover all four of these "requirements", you will have to: Put the text to be copied inside an <input> or <textarea> element. Save the old values of contenteditable and readonly of the element to be able to restore them after copying. Change contenteditable to true and readonly to false . Create a ...

Adding Border Only To The One Side Of The Component In React Native (iOS)

Answer : Even though borderBottom doesn't work on the Text component, it did work for me on the TextInput component, just set editable to false and set the value to your desired text as so... <TextInput style={styles.textInput} editable={false} value={'My Text'}/> const styles = StyleSheet.create({ textInput: { borderBottomColor: 'black', borderBottomWidth: 1, } }); This isn't currently possible. See the following RN issue: https://github.com/facebook/react-native/issues/29 and this ticket on Product Pains: https://productpains.com/post/react-native/add-borderwidth-left-right-top-bottom-to-textinput-/

Convert .cer To .p12

Answer : What works for me dealing with Push Notification certifies has been: Open the certificate: open my_filename.cer and click "View Certificates" to see the certificate's name Go to Applications -> Utilities -> Keychain Access Ensure you have selected the "login" keychain, not the "system" one (thanks to @Matt Flettcher ) Go to "Certificates" Look for the desired certificate Ensure that you can expand it and see under it the original ".certSigningRequest" used to generate the certificate At this moment you should be able to export it as ".p12" try this: given you have files as follow: aps.cer, downloaded from Apple. app.key, your own private key generated by openssl. 1st, convert the .cer file into .pem format: openssl x509 -in aps.cer -inform DER -out aps.pem -outform PEM 2nd, use the .pem file and your private .key to generate .p12 file: openssl pkcs12 -export -out aps.p12 -inkey app.key -in aps.pem ...

Could Not Get GOOGLE_APP_ID In Google Services File From Build Environment

Image
Answer : This worked for me: When install Crashlytic with Firebase, for multiple scheme, you can have error Could not get GOOGLE_APP_ID in Google Services file from build environment . You can fix it by: In Build Settings , add a user define for file name in User Defined : In Build Phases , tap plus button, New Run Script Phase above your Crashlytic build phase, and type this code to the text field. Remember to rename %YOUR_CUSTOM_PATH_TO_FOLDER% to your path to Plist files: GOOGLE_SERVICE_INFO_PLIST_FROM="${PROJECT_DIR}/%YOUR_CUSTOM_PATH_TO_FOLDER%/${FIREBASE_CONFIG_FILE}.plist" BUILD_APP_DIR="${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}" GOOGLE_SERVICE_INFO_PLIST_TO="${BUILD_APP_DIR}/GoogleService-Info.plist" cp "${GOOGLE_SERVICE_INFO_PLIST_FROM}" "${GOOGLE_SERVICE_INFO_PLIST_TO}" I had this in my "Build Phases" and it's works "${PODS_ROOT}/FirebaseCrashlytics/run" "${PODS_ROOT}/FirebaseCrashlytics/uploa...