Expected Expression Error xCode for iOS - objective-c

I get an xCode error for "Expected Expression" on the last line for ]];
[[sections addObject: #[#"Section",
#[#"Videos", #"YOUTUBE", #"UClNZzDwpw3jSjf8bWCMkvrg" ],
#[#"Twitter", #"TWITTER", #"TheMC_OG"],
#[#"Facebook", #"FACEBOOK", #"1450927785128543" ],
#[#"Instagram", #"INSTAGRAM", #"1468344498"]],
#[#"Whiskey Ducks", #"WEB", #[#"http://WhiskeyDucks.us" ]],
#[#"Apparel", #"WEB", #[#"http://GcpMC.Spreadshirt.com" ]],
]];
Im new to Coding and need help fixing this.
here is the full code if you need it in universal Config.m

Try this :
[sections addObject:#[#"Section",#[#"Videos", #"YOUTUBE", #"UClNZzDwpw3jSjf8bWCMkvrg" ],#[#"Twitter", #"TWITTER", #"TheMC_OG"],#[#"Facebook", #"FACEBOOK", #"1450927785128543"],#[#"Instagram", #"INSTAGRAM", #"1468344498"],#[#"Whiskey Ducks", #"WEB"], #[#"http://WhiskeyDucks.us"],#[#"Apparel", #"WEB"], #[#"http://GcpMC.Spreadshirt.com"]]];

Related

platform dependent linker flags in bazel (for glut)

I am trying to build the c++ app with glut using bazel. It should work on both macos and linux. Now the problem is that on macos it requires passing "-framework OpenGL", "-framework GLUT" to linker flags, while on linux I should probably do soemthing like
cc_library(
name = "glut",
srcs = glob(["local/lib/libglut*.dylib", "lib/libglut*.so"]),
...
in glut.BUILD.
So the question is
1. How to provide platform-dependent linker options to cc_library rules in general?
2. And in particular how to link to glut in platform-independent way using bazel?
You can do this using the Bazel select() function. Something like this might work:
config_setting(
name = "linux_x86_64",
values = {"cpu": "k8"},
visibility = ["//visibility:public"],
)
config_setting(
name = "darwin_x86_64",
values = {"cpu": "darwin_x86_64"},
visibility = ["//visibility:public"],
)
cc_library(
name = "glut",
srcs = select({
":darwin_x86_64": [],
":linux_x86_64": glob(["local/lib/libglut*.dylib", "lib/libglut*.so"]),
}),
linkopts = select({
":darwin_x86_64": [
"-framework OpenGL",
"-framework GLUT"
],
":linux_x86_64": [],
})
...
)
Dig around in the Bazel github repository, it's got some good real world examples of using select().
I had a similar problem but with picking the right compiler depending on the platform and #zlalanne's solution didn't work for me. After 2 days of frustration, I finally found the following solution:
config_setting (
name = "darwin",
constraint_values = [ "#bazel_tools//platforms:osx" ]
)
config_setting (
name = "windows",
constraint_values = [ "#bazel_tools//platforms:windows" ]
)
I didn't have any need for linux, but adding this to your BUILD file should work:
config_setting (
name = "linux",
constraint_values = [ "#bazel_tools//platforms:linux" ]
)
Use ":darwin", ":windows" and ":linux" in your selects and you should have a solution that works.

Extra JSON value to display in Objective C

In my app, I get the following response for a failed user login:
{
"non_field_errors": [
"User account is disabled."
]
}
Is there a way to get this in Objective-C to only display: User account is disabled.?
When I do the following, it displays:
(
"User account is disabled."
)
Code:
NSLog(#"%#",[JSONValue objectForKey:#"non_field_errors"]);
How can I remove the parentheses and double quotes?
Parentheses is there because you are getting response in such a way. you can access your data using following way.
JSONValue[#"non_field_errors"][0] // This will return User account is disabled.
That is because the value for key non_field_errors is a JSON Array (Notice the square brackets). So use this :
NSArray *arr = [JSONValue objectForKey:#"non_field_errors"];
NSLog(#"%#",[arr firstObject]);
or just cram it all in one line
[(NSArray*)[JSONValue objectForKey:#"non_field_errors"] firstObject];

Why am I unable to save my UIFontDescriptor into a variable?

I have the following code:
UIFontDescriptor *fd = [UIFont fontWithDescriptor:[[UIFont systemFontOfSize:[UIFont systemFontSize]].fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold|UIFontDescriptorTraitItalic];
But it gives me the error "Expected expression". What does that mean?
Initially, I counted 4 open brackets and 3 close brackets, which will cause an error. Additionally, fontWithDescriptor: should be fontWithDescriptor:size:, which is probably the expected expression.
Finally, using fontWithDescriptor:size: to define a font, then asking for its descriptor is redundant, so a cleaner version of the command is this:
UIFontDescriptor *fd = [[[UIFont systemFontOfSize:[UIFont systemFontSize]] fontDescriptor] fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold|UIFontDescriptorTraitItalic];

ERROR printing report OpenERP OpenOffice writer : name l is not defined?

i want to print report with OpenERP and Open Office Writer: i try with this simple rml to test the origin of the error :
[[ repeatIn(objects,'l') ]]
[[ l.date_contrat ]]
[[ repeatIn(l.lst_termes,'lst_termes') ]]
[[ lst_termes.descriptionterme ]]
i dont know why the origin of the error : object l is not defined. please someone help me.
i want to say tha this is the relation between contrat and terme
class contratcommercial(osv.osv):
_name='contratcommercial'
_inherit='contrat'
_rec_name = 'titreContrat'
_columns = {
'id_partenaire_commercial':fields.many2one('commercial','Commercial'),
'lst_termes':fields.one2many('terme','id_contrat_comm','Liste des termes'),
}
contratcommercial()

Applescript from Mac App says "Expected end of line but found \U201c\"\U201d."

I am trying to perform a copy/paste for my to the the last active app, here's my code:
NSString *appleScriptSource = [NSString stringWithFormat:#"\ntell application \"%#\" to activate\ntell application \"System Events\" to tell process \"%#\"\nkeystroke \"v\" using command down\nend tell", [lastApp localizedName], [lastApp localizedName]];
NSDictionary *error;
NSAppleScript *aScript = [[NSAppleScript alloc] initWithSource:appleScriptSource];
NSAppleEventDescriptor *aDescriptor = [aScript executeAndReturnError:&error];
The problem is that on some computers it works just fine, but on others it fails. My error output from error that is returned by executeAndReturnError is:
2012-06-13 17:43:19.875 Mini Translator[1206:303] (null) (error: {
NSAppleScriptErrorBriefMessage = "Expected end of line but found \U201c\"\U201d.";
NSAppleScriptErrorMessage = "Expected end of line but found \U201c\"\U201d.";
NSAppleScriptErrorNumber = "-2741";
NSAppleScriptErrorRange = "NSRange: {95, 1}";
})
I can't seem to figure out what it means or why it happens.
We tried copying the generated apple-script code into the Apple Script editor, and here it works just fine.
My App is sandboxed - i have added the bundle identifiers for the key "com.apple.security.temporary-exception.apple-events" for the apps i want to support.
Any suggestions?
I am guessing that the \u201c and \u201d are red herrings and just represent smart quotes around a double quote in the error message produced by apple script, and your issue lies with the localized name of the last application you are formatting into the script. I am not sure why you might see this on one machine and not another.
For example if the name was 'Some " App' then the double quotes would end up mismatched as it would end up injected into the middle of a double quoted string. You might want to try and replace any double quotes in the name with '\"' which will escape them.
e.g.
NSString *esc = [[lastApp localizedName] stringByReplacingOccurrencesOfString:#"\"" withString:#"\\\""];