0
0
iOS Swiftmobile~10 mins

App Store Connect submission in iOS Swift - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the app version in the Info.plist file.

iOS Swift
let appVersion = (Bundle.main.infoDictionary as? NSDictionary)?[1]("CFBundleShortVersionString") as? String
Drag options to blanks, or click blank then click option'
Aobject(forKey:)
BgetValue(forKey:)
Cvalue(forKey:)
DfetchValue(forKey:)
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods that don't exist on infoDictionary.
Confusing method names like value(forKey:) which is for KVC.
2fill in blank
medium

Complete the code to upload an app binary to App Store Connect using altool.

iOS Swift
xcrun altool --[1] -f MyApp.ipa -t ios -u user@example.com -p app-specific-password
Drag options to blanks, or click blank then click option'
Aupload
Bupload-appstore
Cupload-apps
Dupload-app
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect or non-existing commands like upload-app.
Confusing altool commands with other tools.
3fill in blank
hard

Fix the error in the code to set the build number in Info.plist before submission.

iOS Swift
if let infoPlistPath = Bundle.main.path(forResource: "Info", ofType: "plist") {
  var plist = NSMutableDictionary(contentsOfFile: infoPlistPath)
  plist?.setValue([1], forKey: "CFBundleVersion")
  plist?.write(toFile: infoPlistPath, atomically: true)
}
Drag options to blanks, or click blank then click option'
A123
B"123"
CNSNumber(value: 123)
Dnil
Attempts:
3 left
💡 Hint
Common Mistakes
Passing an integer instead of a string.
Passing nil which causes a crash.
4fill in blank
hard

Fill both blanks to complete the code that checks if the app archive exists before uploading.

iOS Swift
let fileManager = FileManager.default
if fileManager.[1](atPath: "[2]") {
  print("Archive found, ready to upload.")
}
Drag options to blanks, or click blank then click option'
AfileExists
BfileExists(atPath:)
Cexists
DMyApp.xcarchive
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names like fileExists without parameters.
Forgetting to provide the archive path.
5fill in blank
hard

Fill all three blanks to complete the Swift code that prepares the app metadata dictionary for submission.

iOS Swift
let metadata: [String: Any] = [
  "[1]": "MyApp",
  "[2]": "1.0",
  "[3]": "This is a great app."
]
Drag options to blanks, or click blank then click option'
AappName
Bversion
Cdescription
DappVersion
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect or inconsistent keys.
Mixing up version and appVersion keys.