iOS Programming

Subscribe to iOS Programming feed
A subreddit to share articles, code samples, open source projects and anything else related to iOS, watchOS or tvOS development. Swift or Objective-C.iOS Programming
Updated: 1 min 36 sec ago

tableView. contentInsetAdjustmentBehavior not working

Fri, 11/16/2018 - 23:04

As what I understood from the book I'm learning from, this method, when set to .never, should tell iOS not to adjust the content area and by that the table view should be shifted upwards but that's not happening for me.

I still get the left design that you can see in here :

https://i.redd.it/vc41vro7ety11.png

I've attached the project as well if someone can be so kind to see if it's a problem of auto layout instead, I checked everything for a long time and I did exactly as instructed by the book, also I checked his project and compared it to mine and his is working good but still I can't find what's wrong in mine.

https://drive.google.com/file/d/1bik57VZ_pKr79EsbWYufhfLnyOhhsvee/view?usp=sharing

The said code line is at the RestaurantDetailViewController class at viewDidLoad method.

submitted by /u/mountSin
[link] [comments]

Is iTunesConnect not working fine for you?

Fri, 11/16/2018 - 14:20

Three days ago I was not able to enter in “Sales and Trends”, now I can enter but I am not able to see any data after Nov 13. Is this happening to anybody else? I know that sometimes it takes sometime to update the data, but honestly I don’t remember the last time that it was more than one day behind. Image

submitted by /u/euro02
[link] [comments]

Sharing accessibility identifiers between app and UI test sources

Fri, 11/16/2018 - 14:08

Through an extension you can use an enum for your view accessibility identifiers. By adding the enum to the app target and the UI test target, you can also avoid duplicating strings. Its nice to use an enum rather than strings, but also good for avoiding errors! 🔍

// App sources extension UIAccessibilityIdentification { var viewAccessibilityIdentifier: ViewAccessibilityIdentifier? { get { fatalError("Not implemented") } set { accessibilityIdentifier = newValue?.rawValue } } } addContactButton.viewAccessibilityIdentifier = .addContactButton // Test sources extension XCUIElementQuery { subscript(key: ViewAccessibilityIdentifier) -> XCUIElement { return self[key.rawValue] } } XCUIApplication().buttons[.addContactButton].tap()

Been using it for while to interact with views in XCUI tests. Thoughts?

submitted by /u/nanocinder
[link] [comments]

Saving 2 different arrays that contain the same Core Data Object?

Fri, 11/16/2018 - 11:11
func loadItems() { let request: NSFetchRequest<Habit> = Habit.fetchRequest() do { list = try context.fetch(request) done = try context.fetch(request) } catch { print("Error fetching data from context: \(error)") } self.tableView.reloadData() }

this causes it to freeze but when its loading only the first list its fine

submitted by /u/MARTIALIS20
[link] [comments]

How to check if the user has an Apple Watch paired with his iPhone? (Want to prompt Watch users only, to install the watch app)

Fri, 11/16/2018 - 03:45

Am creating an iPhone app with an accompanying Watch app. If the user has a paired Watch, but has not yet installed the watch app, I want to prompt the user that "this (iPhone) app also has an accompanying app, and please install the watch app for added convenience". How can I check if the user has a Watch?

I know how to check if the app is already installed, but if it is not, I would like to prompt only to Watch users about installing the Watch app and show nothing about this to non-Watch users.

submitted by /u/iLearn4ever
[link] [comments]

How do I automate this release workflow?

Fri, 11/16/2018 - 02:49

I have a base url defined in a swift struct like this:

public struct MyConstants{ static let WEBURL = "https://test.myurl.com/" //static let WEBURL = "https://prod.myurl.com/" //static let WEBURL = "https://demo.myurl.com/" }

Whenever I need to release a new build, I have to archive the app 3 times with 3 different urls manually. After archiving 3 builds, I have to distribute 3 archives with ad-hoc distribution to 3 different folders.

My question is how can I make this easier or even automate?

submitted by /u/dodoloper
[link] [comments]

tvOS Simulator restarting bug in Xcode 10.1?

Fri, 11/16/2018 - 00:54

Hey all. I've been updating an older, more neglected app of mine, and I've finished the iOS updates and am now testing it on tvOS to make sure it all works well and update tvOS specific code where needed, but I'm having a weird issue with the simulator. It keeps repeatedly rebooting, going to the black screen with the spinner on it. Even with no apps installed or running on it, it still does this. I don't even have to touch it, I can just see it restarting over and over in the background. As a result, this makes developing for Apple TV a pain in the ass, as I don't have easy access to my physical Apple TV right now.

The iOS simulator has no such issue, and all simulators over there work fine, across multiple iOS versions. It's only tvOS simulators, on all tvOS versions, across the 4K and regular 4th gen.

What I've tried:

  • Reboot my Mac
  • Restart the Simulator
  • Erasing all content and settings on the Simulator
  • Clearing derived data, and all that stuff

Anyone else having this issue, and does anyone have a fix? It's driving me mad. I just want to make sure my app works right quick before trying it on my real Apple TV this weekend 😢

Edit: The system log only reveals this:

(com.apple.assertiond): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

No errors before this, and after this it's only typical tvOS boot stuff. Nothing out of the ordinary here. Assertiond isn't loading but I have no idea why.

submitted by /u/ihatecompvir
[link] [comments]

Live financial data using Yahoo Finance or Quandl API

Thu, 11/15/2018 - 22:48

I recently started working on an app that takes the prices of some stocks/indices, but I am completely at a loss as to how to get the JSON file form the api link. I feel like I can figure out how to parse a JSON file into a readable format later, so I am trying to focus on how I can get the JSON file itself.

This is the link that Quandl provides in their documentation: https://www.quandl.com/api/v3/datasets/EOD/SYMBOL.json?api\_key=yourapikey

This video was the closest to what I wanted, but when I try and use the code in the video directly I get all kinds of errors. The code that the video uses is this:

URLSession.shared.dataTask(with: NSURL(string: temp_url) as! URL) {

data, responce, error in

print(data)

}.resume()

I tried to fix them but after finally being able to compile the console gave me this:

libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform.

How can I fix this problem, or is there a better way to get access to the JSON file? I have looked all over for tutorials on how to do this sort of thing, but most of them seem to either be outdated or incomplete.

Any help would be appreciated.

submitted by /u/jse-
[link] [comments]

Adding my Subclass of SKShapeNode

Thu, 11/15/2018 - 17:05

Hi I made a subclass of an SKShapeNode Here:

import Foundation import SpriteKit import GameplayKit public class Player: SKShapeNode { init(circleOfRadius: CGFloat, wallCat: UInt32, ballCat: UInt32) { super.init() self.position = CGPoint(x: 100, y: 75) self.fillColor = .blue self.zPosition = 5 self.physicsBody = SKPhysicsBody(circleOfRadius: 12) self.physicsBody?.categoryBitMask = ballCat self.physicsBody?.isDynamic = true self.physicsBody?.contactTestBitMask = wallCat self.physicsBody?.collisionBitMask = wallCat self.physicsBody?.affectedByGravity = false } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } }

yet when I added it to my GameScene

var ball:Player! override func didMove(to view: SKView) { ball = Player(circleOfRadius: 12, wallCat: wallCat, ballCat: ballCat) self.addChild(ball) }

It didn't appear?? Any ideas??

submitted by /u/CuanYoung
[link] [comments]

How to get used to Xcode 10 placeholder highlighting after Enter? (It was Enter + Tab before)

Thu, 11/15/2018 - 14:49

Consider Xcode 10, when you have function with multiple (fore example) parameters, and you format it like: one parameter - one line. You press Enter and the next placeholder is highlighted automatically.

I can't get used to this new feature. Before I was pressing Enter + Tab to highlight the parameter, for 6 years. And now I continue to do so automatically... Then I need to hit Backspace to remove extra whitespaces I just added.

I see two ways to solve my problem:

  1. Disable this feature in Xcode.
  2. Somehow change my fingers memory and stop press Tab after Enter.

In both cases I don't know how.

submitted by /u/debgul
[link] [comments]

Setting up unit testing for Xcode

Thu, 11/15/2018 - 14:18

Hey guys I need some help with setting up unit testing. The moment I added @testable import MyApp to my test code, google/signIn.h will complain that file is not found. Am i missing a step?

submitted by /u/Changjeff
[link] [comments]

How would you filter adult URLs that might get uploaded in a Firebase app?

Thu, 11/15/2018 - 13:24

At the moment my only defenses for filtering unsafe websites is running it through Google's Safe Browsing API but it doesn't detect adult URLs such as porn sites.

Is there something out there that can help with this or will it just have to be done through human moderation?

Thanks

submitted by /u/Vassangel
[link] [comments]

Navigation Help (Using Storyboard)

Thu, 11/15/2018 - 12:35

This is driving me crazy and I can't seem to figure it out.

I'm trying to have both a navigation bar and a tab bar, and I think they are conflicting somehow.

From left to right in the screenshot, there's a splash screen, then the Leagues view (which will contain a table), and then a Players view which contains another table containing a list of players. The Players view will belong to a tab bar controller, along with a couple other views such as Settings that will be tied to the individual League selected.

On every tab, the user should see the back button (to Leagues) as it does now, so this part is correct.

However, on the Players VC, I want to add a right bar button item and it doesn't seem to allow me to do that. I also had a title added before I embedded the view into the tab bar controller that has now disappeared as well. Finally, I had a search bar for the Player view set up in code that also is no longer being added.

Am I going about this the wrong way?

Screenshot: https://imgur.com/QtJVlcu

submitted by /u/PCUK
[link] [comments]

Does anyone have experience with refactoring an entire app vs. rebuilding it from the ground up?

Thu, 11/15/2018 - 12:00

I have an app that I have been working on for a couple years now. When I began making it, I knew about 10% of what I know now about iOS, Swift, MVP, the BaaS, etc. Because of the difference between where I started and where I am now, it's pretty hard to move forward because of how much of a hunk of junk the underlying architecture/difference in code quality is.

Should I try to refactor the existing project are take a couple months and completely remake it?

submitted by /u/hagrids_a_pineapple
[link] [comments]

Pages