Posts

Showing posts with the label Ios

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...

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-/

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

App Store Connect Operation Error: ITMS-90164 [] For Key Com.apple.developer.healthkit.access

Image
Answer : I wouldn't change our code too much, this appears to be something on Apple's end that hopefully they'll fix soon. https://developer.apple.com/system-status/ Remove the following line in the .entitlements file <key>com.apple.developer.healthkit.access</key> <array/> This not work :(. Binary will be rejected ITMS-90000: This bundle is invalid - $message. What work for me: First, when you enable your app’s HealthKit capabilities: you must also select the Clinical Health Records checkbox! Next, you must provide a Health Records Usage string in your app’s Info.plist file. Update: It looks like Apple fixed this issue yesterday (January 21, 2021). I don't see the error anymore. I have the same issue. If I read that error correctly it fails because the value for com.apple.developer.healthkit.access is different in the App Store provisioning profile and in the entitlements file. And it's indeed different. When I enable HealthKit ca...

Auto Layout: Y Position As The Max Of Two Values

Image
Answer : Here's one way to think about it: create a constraint that the top of playButton is greater than or equal to the bottom of myView1 plus 10, another constraint that the top of playButton is greater than or equal to the bottom of myView2 plus 10, and then a third constraint that the top of playButton be at the top of the shared superview at a low priority. The two inequalities will make sure the button is below the two views. However, that leaves ambiguity. The button could be anywhere below both. The third constraint can't be satisfied as such, but the auto layout system will try to get as close as possible. This resolves the ambiguity. The button will be as close to the top as possible while still being below both views. This can actually be simplified. You could sort of combine one of the inequalities with the low-priority equality. Have one constraint that the top of playButton is greater than or equal to the bottom of myView1 plus 10. Have a second constrain...

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...

Capturing Mobile Phone Traffic On Wireshark

Answer : Here are some suggestions: For Android phones, any network : Root your phone, then install tcpdump on it. This app is a tcpdump wrapper that will install tcpdump and enable you to start captures using a GUI. Tip: You will need to make sure you supply the right interface name for the capture and this varies from one device to another, eg -i eth0 or -i tiwlan0 - or use -i any to log all interfaces For Android 4.0+ phones : Android PCAP from Kismet uses the USB OTG interface to support packet capture without requiring root. I haven't tried this app, and there are some restrictions on the type of devices supported (see their page) For Android phones : tPacketCapture uses the Android VPN service to intercept packets and capture them. I have used this app successfully, but it also seems to affect the performance with large traffic volumes (eg video streaming) For IOS 5+ devices, any network : iOS 5 added a remote virtual interface (RVI) facility that lets you use M...

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)") } } } ...

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

Check OS Version In Swift?

Answer : For iOS, try: var systemVersion = UIDevice.current.systemVersion For OS X, try: var systemVersion = NSProcessInfo.processInfo().operatingSystemVersion If you just want to check if the users is running at least a specific version, you can also use the following Swift 2 feature which works on iOS and OS X: if #available(iOS 9.0, *) { // use the feature only available in iOS 9 // for ex. UIStackView } else { // or use some work around } BUT it is not recommended to check the OS version. It is better to check if the feature you want to use is available on the device than comparing version numbers. For iOS, as mentioned above, you should check if it responds to a selector; eg.: if (self.respondsToSelector(Selector("showViewController"))) { self.showViewController(vc, sender: self) } else { // some work around } Update: Now you should use new availability checking introduced with Swift 2: e.g. To check for iOS 9.0 or later at ...

Change/update Firebase Notification Token Or Instance Id Forcefully Via Code?

Answer : Now i got my answer after facing many troubles for generating new or change token of firebase for push notification. 1) Delete old Firebase token let instance = FIRInstanceID.instanceID() _ = FIRInstanceID.delete(instance) FIRInstanceID.instanceID().delete { (err:Error?) in if err != nil{ print(err.debugDescription); } else { print("Token Deleted"); } } 2) Request new Firebase token if let token = FIRInstanceID.instanceID().token() { print("Token \(token) fetched"); } else { print("Unable to fetch token"); } FIRMessaging.messaging().connect { (error) in if (error != nil) { print("Error connecting to FCM. \(error.debugDescription)") } else { print("Connected to FCM.") } } UPDATE FOR SWIFT 4 & Firebase 4.8.2 (Follow simple two steps) 1) Delete old Token let instance = InstanceID.instanceID() instance.deleteID { (error) in print(error.debugD...

Background Tasks On IOS 13 (BGTaskScheduler)

Answer : No , After restarting the device or after killing the app manually , no Background Task will be executed or start again automatically. It is because then the State of Your App will be Changed Various methods of AppDelegate are given in the Apple Docs , which handles different States of the App (ForeGround/BackGround/Terminated etc.) If you manually kill your app then applicationWillTerminate(_ application: UIApplication) will be executed in your AppDelegate.swift file (So , you can set some action to perform which will be executed just before app will be manually killed.) Note that when it executes Your any BackGround Task will also be terminated & the State of your app is changed from BackGround -> Terminated When we Switch off or Restart the device , It is an external event and has nothing to do with your app, So we are not able to determine the State of the App Even if your App is in the Back-Ground and performing any BGTask , if device will be s...

CocoaPods Install Issue

Answer : I had the same issue before. I fixed it by putting the following lines in the terminal: cd ~/.cocoapods/repos rm -rf master pod setup You need reinstall cocoapods: so sudo gem uninstall cocoapods sudo gem install cocoapods pod setup I was facing the same issue. I resolved the issue by running the following commands on the same path: rm -rf ~/.cocoapods/repos/trunk/ pod install

Check If CGRect Null In Getter

Answer : When you create an instance of your class, the _frame instance variable is automatically initialized, even before the init method is called. Since _frame is a C-struct ( CGRect ), its memory is cleared to all zeroes. This results in a CGRect with all zero values. CGRectNull is a special, non-zero CGRect . So your check using CGRectIsNull() will never be true. Using CGRectIsEmpty is a more proper check for this. Try - (CGRect)frame { if (CGRectIsEmpty(_frame)) _frame = CGRectMake(0,0,60,60); return _frame; } Here is an updated answer for Swift 4. You are able to simply use CGRect's isNull boolean property to check for CGRectNull now: let someRect = CGRect.null print(someRect.isNull) // true

"Cannot Connect To ITunes Store" In-app Purchases

Image
Answer : Make sure you have signed out of any production iTunes accounts on the device. I was getting this error on my test phone which was logged in with my actual iTunes account. You cannot test apps using your production iTunes account, hence the error. I just wish Apple provided a better error so as to avoid this guesswork... see In-App Purchase FAQ: Cannot connect to iTunes Store Your app is running in the Simulator, which does not support In-App Purchase For testing in app purchases always use real devices. For newcomers, make sure your in-app purchasing product's status is Ready to Submit , with no "missing metadata". In my case, what was missing was the localization of the subscription's group.

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...

Cannot Install Cocoapods - No Podfile Found In The Project Directory

Answer : Steps to add CocoaPods to manage dependencies in your project: sudo gem install cocoapods -> This installs CocoaPods as a piece of software on your machine. Go to the root of your project directory and execute pod init -> This will add a base Podfile to your project. Add the external dependencies that you have to this Podfile by editing it. Run pod install which will fetch all the external dependencies mentioned by you, and associate it with a .xcworkspace file of your project. This .xcworkspace file will be generated for you if you already do not have one. From here on, you should use .xcworkspace file instead of .xcproject / .xcodeproj . Example Podfile Syntax: target 'MyApp' do pod 'AFNetworking', '~> 3.0' end Where AFNetworking is the pod and 3.0 is the specific version that I want to install. Documentation: Using CocoaPods If you want to add a library from GitHub to your own project, after installing gems, ...

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...

Change Push Notifications Programmatically In Swift

Answer : There isn't any way you can change push notifications permission status from program. Also, prompt asking user to allow push notifications can not be shown again and again. You can refer this https://developer.apple.com/library/ios/technotes/tn2265/_index.html. The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day. So using UISwitch to toggle permission status doesn't make any sense unless you use switch status to turn on/off remote notifications from your server. Updated with swift 4 : func switchChanged(sender: UISwitch!) { print("Switch value is \(sender.isOn)") if(sender.isOn){ print("on") UIApplication.shared.registerForRemoteNotifications() } else{ print("...