Post

Replies

Boosts

Views

Activity

Localization and tap gesture
In this app I have a view with 3 textFields or labels on which I have gesture recogniqzers.They work OK.I have localized the app for 2 more languages, and now, when I switxh language (inside the app), I get the following error:2018-02-16 00:19:34.951810+0100 Autonomie[1635:1007703] [Warning] WARNING: A Gesture recognizer (<UITapGestureRecognizer: 0x1757fd90; state = Possible; view = <UITextView 0x17b86600>; target= <(action=autonomieVersionViewTapped:, target=<Autonomie.StartViewController 0x1757f890>)>>) was setup in a storyboard/xib to be added to more than one view (-><UITextView: 0x17ba8000; frame = (60.5 50; 198 25); text = 'version 0.5 © AlphaNums 2...'; clipsToBounds = YES; hidden = YES; opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x175e25d0>; layer = <CALayer: 0x175da320>; contentOffset: {0, 0}; contentSize: {198, 31}>) at a time, this was never allowed, and is now enforced. Beginning with iOS 9.0 it will be put in the first view it is loaded into.<UIButtonLabel: 0x176d3da0; frame = (160 18; 0 0); text = 'Calcular el rango …'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x176d01c0>><UIButtonLabel: 0x1765cc40; frame = (160 18; 0 0); text = 'Calculer autonomie …'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x1765cda0>>And gestures do not work.If I switch back to the original language, everything OK.
2
0
3.5k
Feb ’18
Renew certificates
I've just received Apple notice that some certificates will expire in one month.Your iOS Development Certificate will no longer be valid in 30 days. To generate a new certificate, sign in and visit Certificates, Identifiers & Profiles.So, I went to Certificate, Identifeir and profile link.I effectively see there that I have development certificates to expire soon on 2 machines.I have downloaded (but not revoked) for a first machine.But I'm not sure on what I need to do now to safely install this download in XCode ? And can I do the update for the other machine from here ?
3
0
35k
Apr ’18
What is MGIsDeviceOneOfType
Just installed XCode 10.I receive the following warning:2018-06-05 13:25:47.686865+0200 simpleTest[14581:1428592] libMobileGestalt MobileGestalt.c:875: MGIsDeviceOneOfType is not supported on this platform.Cannot find what MGIsDeviceOneOfType is about.Edited : is it related to Mapping and Geographical Information System (“MGIS”) ?
18
0
45k
Jun ’18
NSLayoutConstraint should not be declared weak in Xcode 10ß2 - Swift 4.2
When compiling this OSX App in XCode 10 beta 2 (Swift 4.2), I get a warning that did not show in XCode 9.4 each time I create an NSConstraint programmaticallyInstance will be immediately deallocated because property 'myConstraint' is 'weak'fileprivate weak var myConstraint : NSLayoutConstraint! myConstraint = NSLayoutConstraint(item: aButton, attribute: .top, relatedBy: .equal, toItem: aView, attribute: .bottom, multiplier: 1.0, constant: 30)However, there is no such warning for IBOutlet@IBOutlet fileprivate weak var anotherConstraint : NSLayoutConstraint!Is it a just a new warning for an error that existed before ? Or did something change in NSConstraint ?Should I treat IBOutlet and programmatically created differently with respect to weak ?
2
0
5.3k
Jun ’18
Using and expressing "case let" statements
After seveal years with Swift, I still find it hard to use the if case let or while case let, even worse with opotional pattern if case let x?.So, I would like to find an expression to "speak" case let more naturally.Presently, to be sure of what I do, I have to menatlly replace the if case by the full switch statement, with a single case and default ; pretty tedious.I thought of canMatch or canMatchUnwrap … with:So, following would readif case let x = y { // if canMatch x with yif case let x? = someOptional { // if canMatchUnwrap x with someOptionalwhile case let next? = node.next { // while canMatchUnwrap next with node.nextAm I the only one with such problem ? Have you found a better way ?
5
0
7.4k
Nov ’18
Unable to install test app on Apple Watch
I repeat this older thread, as it does not show on the forum with my added post !https://forums.developer.apple.com/message/298938#298938I answered to KMT answer (I read the referenced thread)---------------Looks like that triggered the name change dialog.Can you just right click on the watch name without that happening? Try it on the phone, on the left so see what I'm looking for.Otherwise, this sounds like what others went thru (routine pairing v o o d o o ) in this SO thread - seen it ? [ filter does not like v o o …]https://stackoverflow.com/questions/30792520/in-xcode-i-see-no-paired-apple-watch-even-though-the-watch-is-paired-and-the-w-------------------------So, my question nowI run in the same problem.I just got the Apple Watch (4, OS 5.1.1) and use XCode 10.1. OSX 10.13.6I can create the app + WatchOS on simulator without problem. But not on device.The watch is paired with iPhone.I connect iPhone with USB=> get the message :The iPhone "iPhone XS" can not be used because it requires iTunes 12.9 or later. Do you want to download the latest version of iTunes now?I ignore the message (as I think iTunes 12.9 requires Mojave, isn't it ?). Could it be the problem ???In XCode, I select the scheme iPhone Xs of *** + Apple Watch of XXXI run, it compiles OK, but at the end says:"Finished running myApp on Apple Watch of ***" in the XCode barPlus alert:App installation failedThe host is not paired with the device.I have checked in XCode Devices:- on the left, I see iPhoneXS of ***- but not the Watch- On the right of Devices window, I see the PAIRED WATCHES:Apple Watch of XXXI also checked that Apple Watch is listed with an UDID in the Devices listThe scheme was in Debug mode.So, I changed to release mode, and get the message in Scheme that paired devices not available for debug.So, Compile again, but then get message :Could not launch 'Autonomie' on iPhone XS XXXThere was an error preparing Apple Watch de *** for development.Try reattaching the device to which Apple Watch de *** is paired. The device rejected the pairing attempt.So I unpaired the device.ReattachedTruted the hostRun again, just to get again the messageThe host is not paired with the device.I do not see which and where I should pair.
11
0
17k
Dec ’18
Image does not show on launchscreen
I have a launch screen, with a png image.I test either on XCode 11.1 or XCode 11.2beta2.1. It shows on simulator (Version 13.2 (SimulatorApp-912.4 SimulatorKit-570.3 CoreSimulator-681.14)), but does not show anymore on device (Xs 13.1.3)However, UILabels show normally.I cannot be sure, but seems to be since I upgraded to 13.1.3 from 13.1.2I have tested in dark and light mode, no effect.I have removed the app from the device and reloaded, no effect.I tested with opaque or non opaque view as launchscreen view, no effectHowever, image is here: I move a Label to be behind it ; it does not show anymore, which indicates that the image hides it. Just as if image as bachground drew but not its content.Changed imageView background from systemBackground color to no color: no change, except it does not hide the label if moved behind (which was expected)I inserted another image, it shows.-> Conclusion, something not correct in my png image.2. In addition, I note that, in XCode, the launchscreen appears always with black backgroung (I set its color to system background) ; but other storyboards appear as white background (same system background setting).Any clue to 1 and 2 ?
2
0
1.8k
Nov ’19
Headers with compositionalLayout
I'm trying to add headers and footers in a collectionView built as compositional.Colmlection is built perfectly, but no supplementary func is never called: neither viewForSupplementaryElementOfKind nor referenceSizeForHeaderInSection or referenceSizeForFooterInSectionSo I must miss some obvious declaration…I've set the delegates, datasource, regitered classes, made room for headers and footers (did I did this correctly though ?).Everything is for the time created in code, for easier testing.import UIKit class QuickCell4: UICollectionViewCell { let containerView: UIView = { let view = UIView() view.backgroundColor = .white view.translatesAutoresizingMaskIntoConstraints = false return view }() override init(frame: CGRect) { super.init(frame: frame) configureViews() } func configureViews() { addSubview(containerView) containerView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor).isActive = true containerView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor).isActive = true containerView.topAnchor.constraint(equalTo: contentView.topAnchor).isActive = true containerView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor).isActive = true } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } } class MyHeaderFooterClass: UICollectionReusableView { let titleLabel = UILabel() override init(frame: CGRect) { super.init(frame: frame) self.backgroundColor = UIColor.purple // Customize here addSubview(titleLabel) print("MyHeaderFooterClass") } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } override func layoutSubviews() { super.layoutSubviews() titleLabel.sizeToFit() titleLabel.frame.origin = CGPoint(x: 15, y: 10) } } class FourthViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { var collectionView: UICollectionView! let dataColors = [ [UIColor.red, UIColor.blue, UIColor.green, UIColor.magenta, UIColor.purple, UIColor.orange, UIColor.black, UIColor.lightGray, UIColor.blue], [UIColor.red, UIColor.blue, UIColor.green, UIColor.magenta, UIColor.blue] ] let collectionViewHeaderFooterReuseIdentifier = "MyHeaderFooterClass" func createCustomLayout() -> UICollectionViewLayout { let layout = UICollectionViewCompositionalLayout { (section: Int, environment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection? in let leadingItem = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: NSCollectionLayoutDimension.fractionalWidth(1.0), heightDimension: .fractionalHeight(1.0))) leadingItem.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5) let leadingGroupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.7), heightDimension: .fractionalHeight(1)) let leadingGroup = NSCollectionLayoutGroup.vertical(layoutSize: leadingGroupSize, subitem: leadingItem, count: 1) let trailingItem = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: NSCollectionLayoutDimension.fractionalWidth(1.0), heightDimension: .fractionalHeight(1.0))) trailingItem.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5) let trailingGroupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.3), heightDimension: .fractionalHeight(1)) let trailingGroup = NSCollectionLayoutGroup.vertical(layoutSize: trailingGroupSize, subitem: trailingItem, count: 2) let containerGroupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .absolute(250)) let containerGroup = NSCollectionLayoutGroup.horizontal(layoutSize: containerGroupSize, subitems: [leadingGroup, trailingGroup]) let section = NSCollectionLayoutSection(group: containerGroup) section.orthogonalScrollingBehavior = .continuousGroupLeadingBoundary section.contentInsets = NSDirectionalEdgeInsets(top: 20, leading: 0, bottom: 20, trailing: 0) // section.supplementariesFollowContentInsets = true return section } return layout } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. collectionView = UICollectionView(frame: .zero, collectionViewLayout: createCustomLayout()) collectionView.backgroundColor = .systemTeal // .white self.collectionView.delegate = self self.collectionView.dataSource = self self.collectionView.register(QuickCell4.self, forCellWithReuseIdentifier: "cellID4") self.collectionView.register(MyHeaderFooterClass.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: collectionViewHeaderFooterReuseIdentifier) self.collectionView.register(MyHeaderFooterClass.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: collectionViewHeaderFooterReuseIdentifier) // tried adding the following, no change // if let flowLayout = self.collectionView.collectionViewLayout as? UICollectionViewFlowLayout { // flowLayout.sectionFootersPinToVisibleBounds = true // } configureCollectionView() } func configureCollectionView() { collectionView.translatesAutoresizingMaskIntoConstraints = false self.view.addSubview(collectionView) NSLayoutConstraint.activate([ self.collectionView.topAnchor.constraint(equalTo: self.view.layoutMarginsGuide.topAnchor), self.collectionView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor), self.collectionView.leftAnchor.constraint(equalTo: self.view.leftAnchor), self.collectionView.rightAnchor.constraint(equalTo: self.view.rightAnchor) ]) } func numberOfSections(in collectionView: UICollectionView) -> Int { print("Sections: ", dataColors.count) return dataColors.count } func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return dataColors[section].count } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cellID4", for: indexPath) as? QuickCell4 { let colorArray = dataColors[indexPath.section] cell.containerView.backgroundColor = colorArray[indexPath.row] return cell } else { return UICollectionViewCell() } } func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { print("UICollectionViewDelegateFlowLayout") switch kind { case UICollectionView.elementKindSectionHeader: let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: collectionViewHeaderFooterReuseIdentifier, for: indexPath) as! MyHeaderFooterClass headerView.backgroundColor = UIColor.blue headerView.titleLabel.text = "Header" return headerView case UICollectionView.elementKindSectionFooter: let footerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: collectionViewHeaderFooterReuseIdentifier, for: indexPath) as! MyHeaderFooterClass footerView.backgroundColor = UIColor.green footerView.titleLabel.text = "Footer" return footerView default: assert(false, "Unexpected element kind") } } // Step 6: Handle size / make it appear: // Does it needs to be declared @objc func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { print("referenceSizeForHeaderInSection") return CGSize(width: collectionView.frame.width, height: 30.0) } // Does it needs to be declared @objc func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize { print("referenceSizeForFooterInSection") return CGSize(width: 60.0, height: 30.0) } func layoutAttributesForSupplementaryView(ofKind elementKind: String, at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? { let layoutAttributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: elementKind, with: indexPath) if elementKind == UICollectionView.elementKindSectionHeader { layoutAttributes.frame = CGRect(x: 0.0, y: 0.0, width: 200, height: 50) // contentWidth, height: headerHeight) // layoutAttributes.zIndex = Int.max - 3 } return layoutAttributes } }Credit: h ttps://hackernoon.com/complex-collection-view-layouts-in-swift-with-compositional-layout-z0bmk35kwThe only log I get is:Sections: 2Sections: 2
2
1
8.9k
Nov ’19
Most wanted Xcode features…
I propose that we collectively build a list of most wanted XCode features. Those pain points that do make our life more difficult with XCode or less fun.The goal would not be to have a scientifically correct ranking of all those, but simply:- make visible many ideas that have probably been reported in improvement requests- expose in short why that would be a great evolution, what pain point it would solve (functional improvements, not bugs correction)- if possible, discuss the feasibility of each idea.I would agree to update this original post to include new inputs.To avoid a thread where new posts get smaller and smaller in width, would be great to post each new idea as an answer to this original post. Of course discuss an idea as a reply to this idea post itself.Rule of the game would be tolerance, not trying to argue indefinitely on one idea. And be concise in wanted feature descriptionThe ultimate goal would be to influence positively XCode development team to consider the most wanted proposals.At least, have them explain us that one wanted feature in on the way (let's dream), why such idea is not so great, or why it would be too complex to implement…_________________________________Here is a first wanted feature, inspired from a thread in IB forum: https://forums.developer.apple.com/thread/72495Wanted Feature : Storyboard zoom when editing macOS appPain point: makes navigating in MacOS storyboard extremely painful if more than a few windows. Does limit the use of storyboards for MacOS App. The IB post was seen more than 7500 times, so that seems a largely shared concern.Feasibility: done for iOS, so should be possible for MacOS._________________________________Wanted Feature : Automatic/1-button icon, logo, screenshot, launch image generation for all project related devices/screens as mandated by ASC. Current with each new release.Pain point: The number of individually required image-based assets involved for meta data submittals became a burden long ago and continues to require significant labor to suss and satisfy.Feasibility: Xcode already does some of this w/launchStoryboards for new Swift projects, it just needs to be ubiquitous for all similar assets. It's just scripting/image resizing, which should not be a problem on macOS. Yes, I know there are 3rd party tools that help, but they seem to not keep up w/new devices/screen sizes - if they can do it, so can Xcode._________________________________Wanted Feature : More explicit help message when an action cannot be completed in IBPain point: When XCode cannot complete an action (e.g., create an IBOutlet for an IB object), option-cleaning the build folder solves the problem. Numerous issues reported on the forum were solved with this simple action. However, messages from IDE never mention this solution.Feasibility: Just adding (when appropriate) a suggestion in the message._________________________________Wanted Feature : When build fails, propose automatic correction action whenever possiblePain point: As an example, if some asset contains Finder information, a build error occurs, with message "resource fork, Finder information, or similar detritus not allowed Command /usr/bin/codesign failed with exit code 1". One has to go to Terminal, use xattr command and clean laboriously the offending files.Feasibility: As XCode has detected the files, it could propose to do the cleaning itself…- if it can be done with terminal command, so can Xcode._________________________________Wanted Feature : When an API is deprecated, get information on how to replace.Pain point: Most often, when an API is deprecated and we get a warning from compiler, we get no hint on how to replace. Thus, requiring to post on forum (a lot of posts relate to this search for information), search on web to find some hints… At the end losing time and not being sure to make the best decision.Feasibility: Those who deprecated API for sure know how to handle this. Should be (relatively) easy to provide information in doc, and in the deprecation message._________________________________Wanted Feature : When a string is missing for an infoPlist key, give a warning.Pain point: If the required key is missing, app will crash (or be rejected at Appstore verification stage which is a minor harm). I had the case where I called imagePicker, but intended to use only photo, not video. But if user taps on video, that caused a crash.Feasibility: When UIImagePickerControllerDelegate is used, compiler could check that infoPlist is defined for the required keys.._________________________________All comments welcomed.
13
1
3.1k
Dec ’19
Radio NSButton draws weirdly
Here is the set up with views hierarch:- A popover window - a custom view - an NSBox - an NSView - 4 radio buttons, aligned on left verticallyThe radio buttons share the same IBAction (to get the radio button effect)Here is the problem:- the top most radio button draws with an outer blue circle- if I move this button down, or if I hide it, then another one gets the circle- If I select the button, the outer circle remains.
2
0
642
Mar ’20
Video required for WatchOS app ?
I submitted an iOS app with a watchOS companion app.App has been 'Metadata Rejected':Here is the full message:Guideline 2.1 - Information NeededWe have started the review of your app, but we are not able to continue because we need access to a video that demonstrates the current version of your app in use on a physical watchOS device.Please only include footage in your demo video of your app running on a physical watchOS device, and not on a simulator. It is acceptable to use a screen recorder to capture footage of your app in use.Next StepsTo help us proceed with the review of your app, please provide us with a link to a demo video in the App Review Information section of App Store Connect and reply to this message in Resolution Center.To provide a link to a demo video:- Log in to App Store Connect- Click on "My Apps"- Select your app- Click on the app version on the left side of the screen- Scroll down to "App Review Information"- Provide demo video access details in the "Notes" section- Once you've completed all changes, click the "Save" button at the top of the Version Information page.Please note that in the event that your app may only be reviewed by means of a demo video, you will be required to provide an updated demo video with every resubmission.Since your App Store Connect status is Metadata Rejected, we do NOT require a new binary. To revise the metadata, visit App Store Connect to select your app and revise the desired metadata values. Once you’ve completed all changes, reply to this message in Resolution Center and we will continue the review.I have 3 questions:- Is it a systematic requirement for Watch apps ? I did not see in guidelines ; or is it for some reason specific to my app or to the reviewer ?- How can I record video on the Apple Watch ? Should I film the watch while in operation and post this video ? Or is there a direct way to record the video from the watch to iPhone (using system tools, not third party).- I understand it is not video for publication on appstore, but video for tester. So should I include video in the screen captures section or put it on some web site and give a link to it to the tester ?
7
0
3.5k
Mar ’20
Installing Xcode 11.5 from Appstore requires multiple downloads ?
I get a behavior I never experienced before when updating XCode from 11.4.1 to 11.5 from Appstore.I'm using a MBP, MacOS 10.15.4.- When update starts, system indicates (in Launchpad )a download of 2.03 GB (!?! Not 8 GB)- After download, installation starts (or seem to start).- After a minute or so, a new download starts, this time announced as 8.09 GB.Note:I also tried to download from downloads/more.I get a full download (of 8.12 GB), even though the file is labelled (on the web page) as 7.5 GB for then xip file.
1
0
2.0k
May ’20
Is the new forum better ?
The new forum has been there for a week now. I did wait to get accustomed to it so that my comments are not just due to the change factor. I think it is now possible to make some assessment and I would appreciate others’ opinion to see if it is just me… There are some good points: the editor is much less whimsical the possibility to tag topic is a good thing search has improved (a little). But I find really frustrating points: Editor is better and has a live Preview. What a strange concept in the world of the inventor of WYSIWYG ! Did we return to the 90’s editors with their control characters ? Tags are good, but IMHO it would be useful to have major and minor tags. That would help focus when we list threads by tag by making it possible to select only the major one All posts are now reviewed to avoid spam. Good enough. But why can it take hours (in a case, already 5 hours and still in review) for a very simple answer post (no URL, no bizarre word) to be reviewed. A bit frustrating. And that does not allow for any rapidly going discussion. Many features seem to be inspired from SO, but without some critical capabilities, as the inclusion of images. The concept of upvote or downvote has been introduced as well. Was it really needed ? Won’t it lead to some regrettable side effects that we see in SO where some do not dare propose an answer or even ask a question for fear of a negative vote ? That’s particularly the case for anyone not very fluent in english who may not express properly his/her opinion. I did find that previous developers forum was a more welcoming place than SO. Hope that will not change. There are also capabilities that are missing from previous forum (unless they are so well hidden I could not find them): because of increased spacing, there are now just 15 instead 25 posts per page. And you have to scroll a lot more to get at the end of the shorter list. That do slow down the screening. how can one see the threads he contributed to ? Seems we can only filter the one we authored. It seems now quasi impossible to edit a post, and of course delete it. So at the end, instead of the whaooh effect I was expecting I have just a mixed feeling.
16
0
2.8k
Jun ’20
Protocol declaration
I looked at this example of protocol declaration and composition https ://medium. com/@09mejohn/protocol-composition-in-swift-bd7ed6018ac5 protocol CanBark { &#9;&#9;func bark() } protocol CanWaggTail { &#9;&#9;func waggTail() } struct Dog { &#9;&#9; &#9;&#9;// Protocol Composition &#9;&#9;typealias Dependency = CanBark & CanWaggTail &#9;&#9; &#9;&#9;let dogManager: Dependency &#9;&#9;func ballFound() { &#9;&#9;&#9;&#9;dogManager.waggTail() &#9;&#9;&#9;&#9;dogManager.bark() &#9;&#9;} &#9;&#9; } It compiles even though bark() is not defined. More important, how do I declare a Dog: I am requested to declare the dogManager parameter (auto completion tells) let mario = Dog(dogManager: <#T##Dog.Dependency#>) So I try to create let dependency : CanBark & CanWaggTail But how should I initialise dependency for use for mario ?
4
0
458
Sep ’20