The problem is:
As per screenshot below, one can only see the lineChart. I have another struct AffiliateView coded under this Chart:
import SnapKit
import Charts
import DGCharts
class AffiliateViewController: UIViewController {
private lazy var chartView: LineChartView = {
let chart = LineChartView()
chart.noDataText = "No data available."
chart.chartDescription.enabled = false
chart.xAxis.labelPosition = .bottom
chart.rightAxis.enabled = false
chart.legend.enabled = true
chart.backgroundColor = .lightGray // For debugging visibility
return chart
}()
private lazy var containerView: UIView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
// Add container view and chart view to the main view
view.addSubview(containerView)
view.addSubview(chartView)
// Add SwiftUI View inside the container view
let affiliateView = AffiliateView()
let hostingController = UIHostingController(rootView: affiliateView)
addChild(hostingController)
containerView.addSubview(hostingController.view)
hostingController.view.frame = containerView.bounds
hostingController.didMove(toParent: self)
layout()
setupChartData()
}
private func layout() {
// Layout the container view (SwiftUI content)
containerView.snp.makeConstraints { make in
make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
make.left.right.equalToSuperview()
make.height.equalTo(350) // Increase the height for the SwiftUI content
}
// Layout the chart view below the container view
chartView.snp.makeConstraints { make in
make.top.equalTo(containerView.snp.bottom).offset(20) // Space between chart and the affiliate content
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.height.equalTo(200) // Set a fixed height for the chart
}
}
private func setupChartData() {
let dataEntries = [
ChartDataEntry(x: 1, y: 10),
ChartDataEntry(x: 2, y: 20),
ChartDataEntry(x: 3, y: 15),
ChartDataEntry(x: 4, y: 30),
ChartDataEntry(x: 5, y: 25)
]
let dataSet = LineChartDataSet(entries: dataEntries, label: "Clicks per Day")
dataSet.colors = [.blue]
dataSet.valueColors = [.black]
dataSet.circleColors = [.red]
dataSet.circleRadius = 4.0
let data = LineChartData(dataSet: dataSet)
chartView.data = data
chartView.notifyDataSetChanged()
}
}
// SwiftUI View remains in the same file
struct AffiliateView: View {
@State private var customMessage: String = ""
@State private var uniqueLink: String = "Your unique link will appear here."
@State private var clickData: [Double] = [10, 20, 15, 30, 25] // Example data
var body: some View {
NavigationView {
VStack(spacing: 20) {
// TextField for custom message input
TextField("Enter your custom message...", text: $customMessage)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding(.horizontal)
// Generate Link Button
Button(action: generateLink) {
Text("Generate Sign-Up Link")
.font(.headline)
.foregroundColor(.white)
.frame(maxWidth: .infinity, maxHeight: 50)
.background(Color.red)
.cornerRadius(10)
}
.padding(.horizontal)
// Generated Link Label
Text(uniqueLink)
.font(.body)
.multilineTextAlignment(.center)
.padding(.horizontal)
// You can add a chart here if you want to show it in SwiftUI too
/* LineChartView(data: clickData, title: "Clicks per Day", legend: "Daily Clicks") */
}
.navigationTitle("Affiliate Marketing")
.navigationBarTitleDisplayMode(.inline)
}
}
private func generateLink() {
let encodedMessage = customMessage.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? ""
uniqueLink = "https://affiliate.example.com/referral?message=\(encodedMessage)"
addClickData()
}
private func addClickData() {
clickData.append(Double.random(in: 0...100))
}
}
As you see, the AffiliateView has been declared outside of Controller View class. The View content was visible before the lineChart was added into this code. Now the View content is not visible anymore. I have tried to increment/decrement values at make.height.equalTo() but to no avail.
Could anyone kindly point me in the right direction?
Dive into the vast array of tools, services, and support available to developers.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi,
First post and I am a total newbie when it comes to Ipads & Macs... And also this forum, so sorry if I post in wrong section.
My son use Ipad at school and they use Swift Playground there.
To be able to do some programming at home, I have set up Vmware with Sequoia 15.1.
I installed the app Swift Playground and try to run the playground Get Started with Code and some other education playgrounds.
If I understand correctly, it should be some landscape and a figure on the canvas... For me it is only a blue area.
I installed XCode, but could not figure out how to run the learning examples there. Tips? Is it possible to run the education playgrounds there?
I removed Swift Playgrounds and installed it again, same issue.
I also installed IOS 18.1 (?) but I am not sure it is needed.
Any suggestion of how I can get contents to show on the canvas? Except of bying an Ipad. ;)
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Swift Playground
Playground Support
升级到 Xcode 16.2 后,无法打开项目。
Topic:
Developer Tools & Services
SubTopic:
Xcode
Device : macOS Monterey 12.7.6,Xcode 14.2,IOS 16.0.2;
I tried adding -ld_classic or -ld64 to the other link flags,but it did not work for me。
How should I fix this?
Topic:
Developer Tools & Services
SubTopic:
Xcode
Hello,
I submitted my application to enroll in the Apple Developer Program , but I have not received any response or update regarding my request.
Details:
• Submission Date: 01/20/2025
• Account Type: [Individual/Organization]
I have already checked my email, including spam/junk folders, and confirmed that my payment (if applicable) was processed.
Can someone assist me in checking the status of my application or provide guidance on the next steps?
Thank you for your help!
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
We enrolled with a DUNS number 2 weeks ago but account still says in Review.
How long should we expect to wait for our Dev account?
TIA.
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
Years ago, I created a business account within the Apple Developer Program. The business has since been dissolved. How can I return to an individual account to publish new applications?
Sticking with the old organization seems problematic due to tax info, etc. being invalid.
Apple Support told me that I'd need to create a new Apple ID account but this seems equally troublesome. I'm sure I'm not the first face this situation.
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
After several years' lapse, I am coming back into app development for iPhone. Here's what I did:
Renewed my membership to Apple developer
I created a wildcard identifier, "me.joymaker.*"
I created a certificate
Using Xcode, I introduced my newest iPhone (a 12 mini) to Apple developer. Unlike my older models, this one has a UDID with a hyphen in it. To get it to take the UDID I had to remove the-and then paste the remaining continuous number into the field. But then it accepted it, and showed it back to me complete with hyphen.
I created a development provisioning profile using that certificate and ID, checking the box that said "Select all", so that every device registered to my account was included.
Using Xcode, I tried to upload the provisioning profile to the phone.
OOPS. Xcode replies, "Failed to install one or more provisioning profiles on the device. Please ensure the provisioning profile is configured for this device." Yes, I am very that it was!
There was an older identifier in the account, left over from years ago, named "XCode: Wildcard AppID", with an identifier of simply '*'. I tried building a provisioning profile with that one. Same results.
Now what? How to diagnose, how to pursue this?
BTW, although XCode sees this phone without difficulty, Music and Finder don’t. Relevant?? See this question for more details.
Our team is currently handling hang issues and logs received by the Organizer during our project.
Regarding the xCode Organizer, we’d like to ask a few questions:
The hang rate is presented as a bar chart for each app version. Is there any way to get detailed information for each versions? For example, what percentage of the hang rate is attributed to users on different iOS versions?
We've encountered a situation where the hang logs have decreased, but the hang rate has increased. Could you explain why this might occur?
I was wondering how the hang rate is sampled. For instance, does it record all users who experience a hang, or only those under specific conditions? The situation is that we can see only a handful of hang logs (around 13), but we have hundreds of thousands of DAUs. This ratio seems quite off. Could you explain what might cause us to receive such a small number of logs for each version?
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Instruments
Xcode
Organizer Window
Performance
I’m working in the app playground and want to add my usdz file but when i drag drop the file to my main folder i cannot add target to it which leads to a resource not found error while I build my app. It was working on a normal xcode project but while transitioning to app playground it is not working. How can I fix this issue?
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Swift Student Challenge
ARKit
Swift Playground
RealityKit
Bank account info update processing from more than 7 days
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
I recently made the enrollment for developer program and make the payment on Apple developer website. I saw the payment amount is debited from my account. But the developer program is not approved. When I contacted the developer support, they said Apple did not receive the money and you have to enroll again. So, I asked my Bank to make sure the payment is processed or not. The bank said it is already processed and they even sent me reference number and approval number. Even I sent the screenshot of those information, but the support guy keeps saying they did not receive it but without any helpful information to troubleshoot the issue at all. I am really amazed a company such as Apple has such terrible customer support. Now, I have to request payment dispute to my bank about it.
If I do not get my money back, I will tag Apple CEO on x.com and post about it every day with a schedular script.
Hola
Como están? Quisiera saber cuando se demora un apple en enviar el correo en respuesta a la solicitud de paquete de implementaron para la licencia Fairplay ya que se hizo hace 5-6 días
Muchas gracias
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
Hello all!
My application written with C++ for iOS. Want to make some functionality in static library for the purpose of reuse it in different C++ projects. Want to make universal library for using StoreKit2. Global idea is to wrap StoreKit2 Swift out with CPP interoperability.
Now trying to make clear for my self how to create C++ static library with Swift interoperability for iOS in XCode. There are only Objective-C option when you creating static library in XCode for iOS. Is it correct:
Create Static Library with Objective-C in XCode
Remove all default Objective-C files
Add C++ files
Add C++/Swift interoperability in build settings
Add swift classes
Beside all of it some questions:
When C++ static library contain Swift code with interoperability will it require some special settings for project (Swift standard lib or some other settings)? Or it could be used like any other C++ libraries?
What is the optimal build settings in this case to reduce dependencies when using it different projects?
Is there any examples of the same approach for iOS development?
Hi recently when I renewed my Developer account, which had expired I found out it takes 24 hours for the active to be renewed. But your account page does not provide notice of this, and was very confusing for me!
I had to spend the time to contact support to find this out - can we please just have a 'renewal pending' status instead displayed to our developer's accounts? I would greatly appreciate this!
Best Regards,
Justin
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
I’ve just tried to reply to a post and I get an “unauthorized” error page back.
I’m logged in. I’m posting from an iPad, which is unusual, I normally use my Mac.
This post is in part to see if I can post at all, or whether it was just that one reply that is. not working.
Or is it not possible? My idea is a program that can disable low power mode, change my display type to apple XDR, and set my refresh rate to ProMotion (120)
I use the code below for a non-consumable in-app purchase in my apps. Has anybody worked out how to handle this without using any of the deprecated items?
SKPaymentQueue - deprecated,
SKPayment - deprecated,
SKProduct - deprecated,
transactionState - deprecated,
SKPaymentTransaction - deprecated,
finishTransaction - deprecated
func paymentQueue(_ queue: SKPaymentQueue, shouldAddStorePayment payment: SKPayment, for product: SKProduct) -> Bool
{
true
}
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction])
{
for transaction in transactions
{
switch transaction.transactionState
{
case .purchasing:
break
case .purchased:
SKPaymentQueue.default().finishTransaction(transaction)
// Hide the restore button
navigationItem.setRightBarButton(nil, animated: true)
// Set the ProVerion in the Db to true
IAPHandler.setProVersionToPurchased()
// Also hide the Purchase button
UIView.animate(withDuration: 1.0, animations: { [weak self] in
self?.purchaseBtn_Outlet.alpha = 0
}) { [weak self] (success) in
if self!.theDevice.isOneOf(K.Device_Groups.SE_3_iPhone8) {
self?.segControlTop_Constraint.constant = 10
} else if self!.theDevice.isPhone {
self?.segControlTop_Constraint.constant = 30
}
}
case .failed:
if let error = transaction.error
{
let errorDescription = error.localizedDescription
print("Transaction failed due to error: \(errorDescription)")
}
case .restored:
SKPaymentQueue.default().finishTransaction(transaction)
// Hide the restore button
navigationItem.setRightBarButton(nil, animated: true)
// Set the ProVerion in the Db to true
IAPHandler.setProVersionToPurchased()
// Also hide the Purchase button
UIView.animate(withDuration: 1.0, animations: { [weak self] in
self?.purchaseBtn_Outlet.alpha = 0
}) { [weak self] (success) in
if self!.theDevice.isOneOf(K.Device_Groups.SE_3_iPhone8) {
self?.segControlTop_Constraint.constant = 10
} else if self!.theDevice.isPhone {
self?.segControlTop_Constraint.constant = 30
}
}
case .deferred:
break
@unknown default:
if let error = transaction.error
{
let errorDescription = error.localizedDescription
print("Transaction failed due to error: \(errorDescription)")
}
break
}
}
}
// Sets the purchase to true in the Db
class IAPHandler: NSObject {
//Get the ProVersion Status
static func isProVersionPurchased() -> Bool
{
let VC_String = "IAPHandler"
var theStatus = false
do {
let settings = try Database.shared.databaseConnection!.read { db in
try My_Settings.fetchOne(db)
}
let theStatusText = settings?.ProVersion ?? "false"
theStatus = theStatusText == "true" ? true : false
} catch {
print("Getting the ProVersion Status failed! \(VC_String) \(error)")
}
return theStatus
}
// Set ProVersion to true.
static func setProVersionToPurchased()
{
let VC_String = "IAPHandler"
do {
try Database.shared.databaseConnection!.write { db in
try db.execute(sql: "UPDATE My_Settings SET ProVersion = :proVersion WHERE Settings_ID = :id",
arguments: ["proVersion": "true", "id": 1])
}
} catch {
print("Update set pro version, failed! \(VC_String)s \(error)")
}
}
}// End of class
Am running Xcode 16.1 on Sequoia and am getting "No such module" error.
Here are my steps:
Create workspace in Xcode and name it AccessControl2
Create Project named OrangeInc and add it to AccessControl2 group.
Create blank playground named AccessControl and add it to AccessControl2 group
Error message in playground after I add "import OrangeInc" reads "No such module"
Have tried repeating this several times; get same error message.
I created a fairplay.cer file using the below commands :
openssl genrsa -out private_key.pem 1024
openssl req -new -key private_key.pem -out request.csr
Here, I manually entered the Country, Organization, etc.
I was supposed to use the below commands to make the same :
openssl genrsa -aes256 -out privatekey.pem 1024
opensslreq-new-sha1-keyprivatekey.pem-outcertreq.csr-subj
"/CN=SubjectName /OU=OrganizationalUnit /O=Organization /C=US"
Owing to this, I am unable to create a .p12 file through Keychain Access. I thus want to generate a new fairplay.cer file for Fairplay 4.x. I want to revoke the certificate in order to generate a new one (as it has a limit of 1 certificate for Fairplay)
Requesting developer support from Apple. Have raised multiple requests over the past 4 days.