This works as a stand alone script:
loadList()
on loadList()
set delimitedList to {}
try
set myPath to ((path to home folder) & “Just A Folder:” as Unicode text)
set oldDelims to AppleScript’s text item delimiters – save their current state
set AppleScript’s text item delimiters to {“\n”} – declare new delimiters
set fRef to open for access file (myPath & “theList.txt”)
set theText to read fRef as «class utf8»
set delimitedList to every text item of theText
close access fRef
set AppleScript’s text item delimiters to oldDelims – restore them
on error
set AppleScript’s text item delimiters to oldDelims – restore them in case something went wrong
end try
display dialog item 1 of delimitedList
display dialog item 2 of delimitedList
end loadList
However, when I use the same code in an Xcode application, it fails with nothing in delimitedList, with is error:
Can’t get item 1 of {}. (error -1728)
Any help is appreciated.