Post

Replies

Boosts

Views

Activity

UILabel truncates inside UIStackView?
So, using UIStackView, I've noticed that some UILabels seem to want to truncate instead of wrap to a new line... Anyone else noticed this? The label's number of lines is set to 0.There's a stack view with two labels in it. The stack view is setup to be horizontally and vertically centered in its superview with at least 10 points from the trailing and leading margins. I'd expect the labels to wrap to a new line, not truncate.Any thoughts?
6
2
21k
Aug ’15
CloudKit.js: Querying for IN of Array of References
Howdy,Let's say I've got an 'Order' record type and a 'Transaction' record type. Transaction has a reference to order.I have an array of recordNames of orders and I want to get transactions that match any of the orders. Can I do this? I've been having trouble. var orderReferences = []; orderIdentifiers.forEach(function(orderIdentifier) { var orderReference = { recordName: orderIdentifier, action: "NONE" }; orderReferences.push(orderReference); }); var query = { recordType: "Transaction", filterBy: [{ fieldName: 'order', comparator: 'IN', fieldValue: { value: orderReferences } }] };(forgive my perhaps terrible JS - it's not a language I use a lot)This doesn't work, I get an error back from the server saying it could not decode my reference (I assume because I'm trying to query with an array of references?)How is this supposed to work?Thanks!
3
0
1.5k
Sep ’15
CloudKit.js: Sort by Created Date
Hi,I've got my CloudKit records with created and modifed setup to be sortable and queryable but I'm having a hard time constructing a CloudKit.js query that will use those values.This: var query = { recordType: "MyRecord", sortBy: [{ fieldName: 'created' }] };This doesn't work, I get this error:Unknown field 'CKFieldName{_name='created'}I also tried 'createdDate', 'modified', 'modificationDate' and all give the same error. What's the magic?
6
0
2.8k
Dec ’15
Shortcuts: "There was a problem with the app"
I'm playing with Shortcuts.Siri is telling me "There was a problem with the app" whenever I call the completion handler with a success message. My failure states work.I backed out my custom code and literally just returning static strings in my completion and I'm still getting the error. I'm not really sure how to debug this or where it's going wrong... I'm sending a correctly formed intent response.??
11
0
8.6k
Jun ’18
Trying (failing) to use CreateML to create model for named entity rec w/ Natural Language framework
I'm trying to use CreateML to build a model I can use with the new Natural Language framework for domain-specific named entity recognition in scanning some text. It's actually very very similar to the example in the WWDC '18 video introducing the Natural Language Framework where they add a bunch of products and recognize them.The problem I'm having is that the results I'm getting when I run text through an NLTagger with this model are very inaccurate.Imagine an app for people visiting Las Vegas, NV. I want to be able to identify names of hotels, restaurants and other activities as such. I have training data that looks like this (there's a lot more but it all follows this pattern).{"tokens":["Bellagio","Buffet at Bellagio","Fix Restaurant and Bar","Harvest","Jasmine","Lago","Le Cirque","Michael Mina","Noodles","Picasso","Prime","Spago","Yellowtail","Spa \u0026 Salon","Fountains of Bellagio","Gallery of Fine Art","Hyde Lounge","Lily Bar and Lounge","O ","Petrossian Bar"],"labels":["Hotel","Restaurant","Restaurant","Restaurant","Restaurant","Restaurant","Restaurant","Restaurant","Restaurant","Restaurant","Restaurant","Restaurant","Restaurant","Activity","Activity","Activity","Activity","Activity","Activity","Activity"]}Here's a Playground with my test code. With the below, I'd expect 'Bellagio' to come back as 'Hotel' but when I print the tokens and tags, they all come back as... not that. And some times, the same token comes back as two different tags (i.e. 'MGM Grand' below).What am I doing wrong? Bad training data? Bad training data format? Unrealistic expectations? I have no idea what I'm doing?The last one is definitely true.In the WWDC video demo, it seems to work great and it seems very similar to what I'm doing so not sure where I'm off.import CreateML import Foundation import NaturalLanguage let wordFilePath = Bundle.main.path(forResource:"vegas_words", ofType: "json")! let wordFileURL = URL(fileURLWithPath: wordFilePath) let trainingData = try MLDataTable(contentsOf: wordFileURL) let model = try MLWordTagger(trainingData: trainingData, tokenColumn: "tokens", labelColumn: "labels") let compiledModel = try NLModel(mlModel: model.model) let text = "When in Las Vegas I like to stay at the luxury hotel Bellagio or perhaps Wynn Las Vegas but not MGM Grand or the Luxor. Sometimes I like to dine at Delmonico at The Venetian or at one of the places at MGM Grand." let range = text.startIndex..<text.endIndex var vegasTagScheme = NLTagScheme("Vegas") var tagger = NLTagger(tagSchemes: [.nameType, vegasTagScheme]) tagger.string = text tagger.setModels([compiledModel], forTagScheme: vegasTagScheme) tagger.setLanguage(NLLanguage("en"), range: range) tagger.enumerateTags(in: range, unit: .word, scheme: vegasTagScheme, options: [.omitWhitespace, .joinNames, .omitPunctuation]) { (tag, tokenRange) -> Bool in let token = text[tokenRange] if let tag = tag { print("\(token): \(tag.rawValue)") } return true }When: Hotel in: Hotel Las Vegas: Hotel I: Restaurant like: Restaurant to: Restaurant stay: Restaurant at: Restaurant the: Restaurant luxury: Restaurant hotel: Restaurant Bellagio: Restaurant or: Restaurant perhaps: Restaurant Wynn Las Vegas: Restaurant but: Restaurant not: Restaurant MGM Grand: Restaurant or: Restaurant the: Restaurant Luxor: Restaurant Sometimes: Activity I: Activity like: Activity to: Activity dine: Activity at: Activity Delmonico: Activity at: Activity The: Activity Venetian: Activity or: Activity at: Activity one: Activity of: Activity the: Activity places: Activity at: Activity MGM Grand: Activity
3
0
1.9k
Sep ’18
App Store Connect Rejects Binary - Unable to Compile Bitcode
On builds submitted with Xcode 11b2, after successfully uploading a build I'm getting an email a few minutes later with the following message:ITMS-90562: Invalid Bundle - The app submission can not be successfully recompiled from bitcode due to missing symbols during linking. You can try to reproduce and diagnose such issues locally by following the instructions from: https://developer.apple.com/library/archive/technotes/tn2432/_index.htmlAnyone seen this before and know how to resolve? Following the link, I'm able to export an ad-hoc build with bitcode without any errors locally.
8
0
3.9k
Jun ’19
Help With MLRecommender / CreateML Recommendation
So, I'm playing around a little bit with CreateML and MLRecommender and I'm having a hard time figuring out how to create and train my model. I've got a very simple data set for experimenation but the tools keep kicking things back. Clearly I'm missing something.Here's my data set, movie reviews in CSV format:user_id,movie_id,rating_id 1,Inception,4 1,Interstellar,5 2,Titanic,4 3,Titanic,1With CreateML, I've got a recommender for that file with 'Users' mapped to 'user_id', 'Items' mapped to 'movie_id', 'Ratings' mapped to 'rating_id'.When I ask it to train, I get a training error:"Number of string item ids specified (3) does not equal the number of items given (2)"Hmmmm, not sure what that means. Can anyone help? I feel like it must be something really obvious tht I'm missing but I've tried a bunch of variations without any luck.Any help appreciated.
1
0
1.1k
Feb ’20
Can an app have multiple widget extensions?
Is there a problem with an app having more than one widget extension? I previously had two 'Today View' extensions that I'm replacing but after installing the app on device with two widget extensions, I'm only seeing the second one in the widget picker. I see that there's WidgetBundle but my two widgets have very different datasets so the timeline stuff won't mesh.
4
0
6.9k
Jun ’20
Xcode 12 Framework: 'Double-quoted include in framework header, expected angle-bracketed instead'
I've got an iOS framework that I've had around for ages. It's a mixture of Objective-C and Swift. Since installing Xcode 12, I'm now getting a bunch of warnings of the type: 'Double-quoted include in framework header, expected angle-bracketed instead' If I go to the various source files and say change: #import "Place.h" to #import <VegasKit/Place.h> then I get an error saying it can't find the file. If I try this: #import <Place.h> then I get an error telling me to go back to double-quotes, i.e. undo the change. Any idea what I can do to get this all setup correctly? Thanks.
18
1
28k
Jun ’20
Core Data complaining about store being opened without persistent history tracking... but I don't think that it has been
Since running on iOS 14b1, I'm getting this in my log (I have Core Data logging enabled): error: Store opened without NSPersistentHistoryTrackingKey but previously had been opened with NSPersistentHistoryTrackingKey - Forcing into Read Only mode store at 'file:///private/var/mobile/Containers/Shared/AppGroup/415B75A6-92C3-45FE-BE13-7D48D35909AF/StoreFile.sqlite' As far as I can tell, it's impossible to open my store without that key set - it's in the init() of my NSPersistentContainer subclass, before anyone calls it to load stores. Any ideas?
1
0
1k
Jun ’20
Using Table Selection to Populate Other View
Hi, I'm trying to use Table in an app sort of similar to the garden example but imagine if there was a third view in the NavigationView for a third column. And then imagine that if you selected a single plant in the middle table, a sort of detail inspector would appear in the third position with the data from your selection, updating as the selection in the middle table changed. I'm struggling a bit to get this working. I've tried: Wrapping the table column content closure's contents in a NavigationLink. This sort of works but it styles things oddly in the table column and as I scroll around, it seems to trigger on it's own, I'm guessing as cells are re-used or something behind the scenes. This feels wrong. Moving row creation into the rows: parameter with TableRow but the only modifier there is for drag and drop, there's no onTapGesture or similar. Watching for changes to the selected item via the binding and then acting on it then - this fires when I select stuff and I can get the related model object but I can't put a NavigationLink in there as it's outside of the view hierarchy so I'm not sure how to act on it. I'm guessing there's some other way to handle this that I'm simply not thinking of but if anyone has any pointers, much appreciated!
6
0
1.9k
Jun ’21
Correctly Adjust @FetchRequest with @SceneStorage + Backgrounding with Core Data+SwiftUI
Hi, With iOS 15 we can now update the nsPredicate and nsSortDescriptors properties on a @FetchRequest which is great. What I'm wondering though is the correct way to apply/re-apply user data stored in @State and/or @SceneStorage for predicates when a view is init'd. Something like @SceneStorage isn't available in the init method but I find that onAppear isn't called in some circumstances. For example, let's say I have a picker that drives the NSPredicate and the user picks a non-default value. If the app goes into the background and then back to the foreground and that same view is visible, it looks like SwiftUI re-runs the init for the view but does not re-run the onAppear modifier, leaving my UI in an inconsistent state. What's the right way to handle this? Feels like I must be fighting the framework / there must be a better way.
0
0
657
Dec ’21
Xcode 14 Multiplatform Target Won't Build
I'm using the new multiplatform target option in Xcode 14 to add an iPad target to an existing macOS app. The macOS app uses the Sparkle framework to update itself. Sparkle is a macOS-only framework. I added the iPad target and specified the Sparkle framework should only apply to the macOS build but when trying to build the app, Xcode complains that the Sparkle framework doesn’t exist for iOS (true but should not be relevant). Xcode is trying to build/include Sparkle even though it’s marked to not include for iOS builds. Has anyone had any success with this?
0
0
537
Aug ’22
What Does toolbarTitleDisplayMode Do?
Hi, New in iOS 17 and the aligned releases is a modifier "toolbarTitleDisplayMode". What does this do exactly? https://developer.apple.com/documentation/SwiftUI/View/toolbarTitleDisplayMode(_:) I've experimenting with it a bunch and can't ever see it do really anything so I'm sure I'm using it wrong. What is this for?
1
0
547
Sep ’23