Why do I get this 'Use of undeclare identifier addressbook' error? - ios4

NSArray* allPersons = (NSArray*)ABAddressBookCopyArrayOfAllPeople(addressBook);
I get a Use of undeclare identifier addressbook error. Why?

The error you are getting answers your question. You are passing addressBook to the function, but you haven't defined addressBook.

Related

How do you convert an string into an integer in SwiftUI?

I am trying to make a simple calculator using SwiftUI, but one thing frustrates me. For reference, here is the minimum reproducible example:
#State var enteredNumber: String = "" // This is the user input in a string form
#State var usable number: Int = Int(enteredNumber) // I thought this would work but it doesn't.
I found this on hackingwithswift.com, and I thought it would work. I also looked my problem up in stack overflow, but I can't seem to understand any of the questions (I'm sorta new to SwiftUI). The approach I used just gave me an error saying:
Cannot use instance member 'enteredNumber' within property initializer; property initializers run before 'self' is available
and
Value of optional type 'Int?' must be unwrapped to a value of type 'Int'
Thanks in advance for your help!

Swift 3 NSMuttableArray

I'll vey appreciate you for your help.
I am declare new new empty array:
var cellDescriptors = Any
but when i try to use it in somewhere, i am always receive the same error = "Type 'any' has no subscript members".
For example:
var cellDescriptors = [Any]()
var visibleRowsPerSection = [[Int]]()
func loadCellDescriptors() {
if let path = Bundle.main.path(forResource: "CellDescriptor", ofType: "plist") {
cellDescriptors = NSMutableArray(contentsOfFile: path)as AnyObject?
getIndicesOfVisibleRows()
tblExpandable.reloadData()
I read a lot and find that were some changes in Swift 3.0.1, but i can't understand, which changes i need to do , to fix it.
I tried to use the following: swift 3: Type 'Any?' has no subscript members
But unfortunately its not working in my case.
Tried to use [AnyHashable:Any] as well.
Thank you very much!
You're trying to subscript something that the compiler doesn't know is a Collection. cellDescriptors is a [Any], cellDescriptors[indexPath.section] is an Any, and you're trying to subscript that Any.
First of all, don't us NSMutableArray in Swift. You need to declare your cellDescriptors as Array<Array<Something>> (a.k.a. [[Something]]), so that when you subscript it once by indexPath.section, you get an Array<Something> (a.k.a. [Something]). Finally, you can subscript it once more to get your Something. Change Something to whatever type you're actually dealing with.

How to fetch rows based on CRM modifiedon column

I need to pull all rows from an entity which were modified recently. I am using the following statement which gives me an error
from e in myEntity
where e.ModifiedOn.HasValue
select e.cust_name
The error states
Invalid 'where' condition. An entity member is invoking an invalid property or method.
Message Invalid 'where' condition. An entity member is invoking an invalid property or method.
Try with:
from e in myEntity
where e.ModifiedOn != null
select e.cust_name
Using Lambda Expressions:
var getModified = myEntity.where(w=>w.ModifiedOn!=null).select(s=>s.cust_name);

Exception occured with replaceItem and date value

I am getting the following error when trying to set a date value using #Date value with replaceItemValue.
The error I am getting occurs on the last line of code here:
var dt = #Date(2012,1,1);
docContractor.replaceItemValue("NewField","Hello World");
docContractor.replaceItemValue("ContractorStartDateTime",dt);
The error is:
Error while executing JavaScript action expression
Script interpreter error, line=21, col=31: [TypeError] Exception occurred calling method NotesDocument.replaceItemValue(string, Date) null
How can I fix this?
The following works:
docContractor.replaceItemValue("ContractorStartDateTime", session.createDateTime("Today"));
You can find more examples in the Notes and Domino App Dev wiki: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/NotesDateTime_sample_JavaScript_code_for_XPages
Did you try to use a NotesDateTime object instead?
Or use toString ()

QDBus problem: getting org.freedesktop.DBus.Error.UnknownMethod, but method exists

I'm programming C++ on Ubuntu, using QDBus and I've got the following code snippet:
this->m_cRemoteInterface = new QDBusInterface("org.my.service", "/data", "org.freedesktop.DBus.Properties.Get");
QDBusReply<uint64_t> cResult = m_cRemoteInterface->call("property1");
The code throws the following error:
org.freedesktop.DBus.Error.UnknownMethod:
Method "property1" with
signature "" on interface
"org.freedesktop.DBus.Properties.Get"
doesn't exist
But when I issue the following command in a shell, it returns the correct value:
dbus org.my.service /data org.freedesktop.DBus.Properties.Get "
" property1
What could I do wrong?
Thanks in advance, emi
After an afternoon of trail and error:
I declared
org.freedesktop.DBus.Properties.Get
as interface, which is not right.
I had to use only
org.freedesktop.DBus.Properties
as interface and then
call("Get", " ", "property1");
May this help someone. :).

Resources