My current app's version is 3.0 and build 4 (which i set in the identify tab as shown in the picture below). When I created a new Widget Extension and when I build I get this warning: The CFBundleVersion of an app extension ('1') must match that of its containing parent app ('4').
I know for a fact that this is the issue with the build and version number not being the same as my app. But I just don't see a place where I can change it in the Xcode tabs instead of manually changing it in my info.plist
I remember seeing and using the option to change the build and version numbers for widget extensions in Xcode 13, 14.
This how it looks for the iOS app:
This how it looks for the Widget Extension:
Hoping this is just a bug!
Post
Replies
Boosts
Views
Activity
I am trying to add a Tab View to my app. On Xcode 13 it disappears when I navigate to a tab that contains a List or view that has a scroll enabled. I am not sure if this is a bug or not. It works perfectly fine on Xcode 12.5.1 to iOS 15 Device. But Xcode 13 to iOS 15 is not working.
Here is my Code:
struct ContentView: View {
var body: some View {
TabView {
HomeView()
.tabItem {
Image(systemName: "1.circle")
Text("First")
}
.tag(1)
FirstView()
.tabItem {
Image(systemName: "2.circle")
Text("Second")
}
.tag(2)
}
}
}
struct HomeView: View {
var body: some View {
Text("Hello, World!")
}
}
struct FirstView: View {
var body: some View {
NavigationView{
List{
Text("Hello")
}
}
}
}
I made a widget that refresh every 15 minutes but it doesn't refresh it just shows the place holder text.
I think I have an issue in my Timeline Provider.
Please let me know to Refresh it!
import WidgetKit
import SwiftUI
struct Model : TimelineEntry{
var date : Date
var panchangData : [PanchangData]
}
struct Provider : TimelineProvider {
func placeholder(in context: Context) -> Model{
let loadingData = Model(date: Date(), panchangData: Array(repeating: PanchangData(tithi: "Refresh", nakshatra: "Refresh", requestsremaining: 5000, requeststotal: 5000), count: 1))
return loadingData
}
func getSnapshot(in context: Context, completion: @escaping (Model) -> Void) {
let loadingData = Model(date: Date(), panchangData: Array(repeating: PanchangData(tithi: "Refresh", nakshatra: "Refresh", requestsremaining: 5000, requeststotal: 5000), count: 1))
completion(loadingData)
}
func getTimeline(in context: Context, completion: @escaping (Timeline<Model>) -> Void) {
getData{ (modelData) in
let date = Date()
let data = Model(date: date, panchangData: modelData)
let nextUpdate = Calendar.current.date(byAdding: .minute, value: 15, to: date)
let timeline = Timeline(entries: [data], policy: .after(nextUpdate!))
completion(timeline)
}
}
}
func getData(completion: @escaping ([PanchangData])->()){
@AppStorage("userid") var userId: String = "NOTSHOWN"
@AppStorage("authcode") var authCode: String = "NOTSHOWN"
let today = Date()
let formatter1 = DateFormatter()
let formatter2 = DateFormatter()
let formatter3 = DateFormatter()
formatter1.dateFormat = "dd/MM/yyyy"
formatter2.dateFormat = "HH:mm:ss"
formatter3.dateFormat = "Z"
let url = "https://api.panchang.click/v0.4/panchangapi?date=\((formatter1.string(from: today)))&time=\((formatter2.string(from: today)))&tz=\((formatter3.string(from: today)))&userid=\(userId)&authcode=\(authCode)"
let session = URLSession(configuration: .default)
session.dataTask(with: URL(string: url)!){ (data, _,err) in
if err != nil{
print(err!.localizedDescription)
return
}
do{
let jsonData = try JSONDecoder().decode([PanchangData].self, from: data!)
completion(jsonData)
}catch{
print(error.localizedDescription)
}
}
struct WidgetView : View{
var data : Model
var body: some View{
ForEach(data.panchangData,id: \.self){ value in
Text(value.nakshatra)
}
}
}
@main
struct MainWidget : Widget{
var body: some WidgetConfiguration{
StaticConfiguration(kind: "TestWidget1", provider: Provider()){ data in
WidgetView(data: data)
}
.description(Text("test"))
.configurationDisplayName(Text("test23"))
.supportedFamilies([.systemSmall])
}
}
struct WidgetView_Previews: PreviewProvider {
static var previews: some View {
WidgetView(data: Model(date: Date(), panchangData: Array(repeating: PanchangData(tithi: "Refresh", nakshatra: "Refresh", requestsremaining: 5000, requeststotal: 5000), count: 1)))
.previewContext(WidgetPreviewContext(family: .systemSmall))
}
}
}
struct PanchangData: Decodable, Hashable{
var tithi: String
var nakshatra: String
var requestsremaining: Int
var requeststotal: Int
}