Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



I think clang only infers instancetype for legacy/transition compatibility. Apple are updating all their headers to have instancetype as far as I know.

So possibly at some point, clang might could stop inferring it, if it's in the way of some change to the codebase or something.

Adbot
ADBOT LOVES YOU

lord funk
Feb 16, 2004

Doh004 posted:

My separators will randomly disappear in iOS7 because who the gently caress knows! :argh:

As far as I can tell, this is it. A day's worth of troubleshooting for a loving line color, and I give up.

edit: I put a single px height UIView at the bottom of my cell and set the tableView separator style to none. Elegance, simplicity, beauty. iOS 7.

lord funk fucked around with this message at 17:14 on Oct 18, 2013

Doh004
Apr 22, 2007

Mmmmm Donuts...

lord funk posted:

edit: I put a single px height UIView at the bottom of my cell and set the tableView separator style to none. Elegance, simplicity, beauty. iOS 7.

Ugh I used to do this back when I started because I didn't understand separators. If I have to do this again I'm going to knife someone :argh:

lord funk
Feb 16, 2004

I don't know what to say. My newly created tableviews seem to change the separator line without issue. This old one just won't work. I've combed over all the code, re-written it with a .nib and proper dequeue-ing, and it just won't catch.

haveblue
Aug 15, 2005



Toilet Rascal
Speaking of table views, how do I make the section header go away? I've tried returning a nil title, returning a zero height, and returning a nil view from the delegate/datasource, but it still offsets the cells down by 22 pixels.

Doh004
Apr 22, 2007

Mmmmm Donuts...
This is gonna sound dumb, but return a height of 1 (maybe try .01) and a UIVIew with a CGRectZero.

lord funk posted:

I don't know what to say. My newly created tableviews seem to change the separator line without issue. This old one just won't work. I've combed over all the code, re-written it with a .nib and proper dequeue-ing, and it just won't catch.

I hope I didn't come off as mean or saying you didn't know what you're doing - we've all been frustrated by things behaving errantly with these changes :(

Dr Monkeysee
Oct 11, 2002

just a fox like a hundred thousand others
Nap Ghost
Can someone explain to me like I'm 5 what instancetype does for you? I don't understand how "type inference" is supposed to work in a dynamically typed language. How is it semantically different from id?

Or is this just to help Xcode's static analyzer be smarter about offering auto-complete suggestions?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
(Ignoring the name-based special casing here) when Foo and Bar are unrelated types, Foo *foo = [[Bar alloc] init]; is a compile error if init returns instancetype, but not if it returns id. It can't just return Bar * because that would require subclasses to override init even if the only thing they want to change is the return type, which would be annoying.

lord funk
Feb 16, 2004

Doh004 posted:

I hope I didn't come off as mean or saying you didn't know what you're doing - we've all been frustrated by things behaving errantly with these changes :(

Oh not at all. Just wanted to express how dumbfounded I am at the whole ordeal.

I am burned out on 'iOS 7 is buggy' being a reason stuff doesn't work. The problem is: it's still true for tons of stuff. I'm trying to push forward with the app and it's getting bogged down in interface minutia.

NoDamage
Dec 2, 2000

pokeyman posted:

Not sure if you had a solution, but it looks like OUITextView has something of a fix. Maybe it'll help you.
I found a fairly thorough solution on StackOverflow: http://stackoverflow.com/questions/19235762/how-can-i-support-the-up-and-down-arrow-keys-with-a-bluetooth-keyboard-under-ios

It's just annoying that we have to resort to so many hacks to get UITextView working the way it used to.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Monkeyseesaw posted:

Can someone explain to me like I'm 5 what instancetype does for you? I don't understand how "type inference" is supposed to work in a dynamically typed language. How is it semantically different from id?

Or is this just to help Xcode's static analyzer be smarter about offering auto-complete suggestions?

It helps tools like the compiler or static analyzer know what type the return value is. There's no semantic difference (though it can affect your code; see below). It's really only helpful when you have methods that return instances of that same class and you want to handle subclasses. For example (sorry if this is way oversimplified), you'll see
Objective-C code:
@interface UIApplication

+ (UIApplication *)sharedApplication;

@end
which isn't very helpful if you then do
Objective-C code:
@interface MyApplication : UIApplication

- (void)doSomethingSpecial;

@end

// later
[[MyApplication sharedApplication] doSomethingSpecial];
because you'll get a warning about a missing selector. Previously you'd fix that with
Objective-C code:
@interface UIApplication

+ (id)sharedApplication;

@end
but then you lose the type information, so you can do
Objective-C code:
[[UIApplication sharedApplication] count]
with no compiler warnings. The best of both worlds would be
Objective-C code:
@interface UIApplication

+ (instancetype)sharedApplication;

@end
because then you could do
Objective-C code:
[[MyApplication sharedApplication] doSomethingSpecial];
with no warnings.

(I'll preface this last part by saying that it doesn't come from my personal experience, but I think I understand it correctly.) There is one practical benefit to all this beyond compiler warnings. If you have two different methods with the same selector whose return types require different variants of objc_msgSend (e.g. you're on x86_64 and one returns an object, the other a largish struct), the compiler needs to know which method is being invoked in order to generate proper code.

TJChap2840
Sep 24, 2009
I developed the fairly popular TerrariViewer for Terraria using C#. I'd like to do the same thing for Terraria on iOS.

  • Is it possible to access a file that another app creates in iOS? For example, a player save file?
  • How bad is Objective-C for iOS development on Windows? I have an old MacBook but would really like to avoid doing any coding on it.
  • What is my entry fee for developing on iOS?

dc3k
Feb 18, 2003

what.

TJChap2840 posted:

I developed the fairly popular TerrariViewer for Terraria using C#. I'd like to do the same thing for Terraria on iOS.

  • Is it possible to access a file that another app creates in iOS? For example, a player save file?
  • How bad is Objective-C for iOS development on Windows? I have an old MacBook but would really like to avoid doing any coding on it.
  • What is my entry fee for developing on iOS?

  • No
  • It's impossible unless (maybe?) you use garbage like PhoneGap or whatever
  • $100/yr

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

TJChap2840 posted:

  • How bad is Objective-C for iOS development on Windows? I have an old MacBook but would really like to avoid doing any coding on it.

status is right, but just to add to this: you'll need Xcode at some point, and that only runs on Mac OS X.

That said, OS X has gotten easier and easier to run as a VM, so that might be an option for you. And if you're feeling particularly masochistic, you could buy some time on a hosted continuous integration server and write code blindly on your Windows box.

Finally, there is Xamarin, a decidedly non-free tool for writing iOS apps in C# with a lot of the .NET stuff included. Actually I'm not sure you need Xcode for that, but I'm guessing you will.

lord funk
Feb 16, 2004

Yeah, some students of mine ran Xcode in an VM without issue.

Status update: 7 invalid binary submissions in a row. gently caress you Distribution Certificate I've done this before why don't you work.

edit: I sacrificed a chicken it's okay now

lord funk fucked around with this message at 20:19 on Oct 19, 2013

Froist
Jun 6, 2004

pokeyman posted:

That said, OS X has gotten easier and easier to run as a VM, so that might be an option for you. And if you're feeling particularly masochistic, you could buy some time on a hosted continuous integration server and write code blindly on your Windows box.

While it is easier to run OS X in a VM, doesn't it still break the licensing terms if the host machine isn't a Mac?

I heard about Virtual Mac this week, which seems to be a farm of macs running VMs "in the cloud" that you can VNC into. So that's another option if you're (TJChap) pressed for doing the build/submission.

Toady
Jan 12, 2009

pokeyman posted:

I'm confused about people starting to declare their init methods as returning instancetype because it's entirely pointless:

http://clang.llvm.org/docs/LanguageExtensions.html#objective-c-features

Am I missing something? Seems to me like people just aren't reading the docs.

Apple's headers do it too (see NSString.h). I started doing it to be consistent with my convenience constructors, pointlessly, I admit.

lord funk
Feb 16, 2004

Got a linking error for one of my static libraries, but only on one of my two targets. Took about 7 hours to realize that turning off an entitlement removed one of my frameworks. There isn't enough booze in the city for this.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

TJChap2840 posted:

I developed the fairly popular TerrariViewer for Terraria using C#. I'd like to do the same thing for Terraria on iOS.

  • Is it possible to access a file that another app creates in iOS? For example, a player save file?
  • How bad is Objective-C for iOS development on Windows? I have an old MacBook but would really like to avoid doing any coding on it.
  • What is my entry fee for developing on iOS?


Sup C# buddy. Others have answered this stuff but let me add a few things:

1. If the other app wants to "play ball" and let your app be the target of an "Open In..." operation then you can pass files around (they get copied into your sandbox, leaving the original alone) but otherwise everything is still restricted to each app's own sandbox for security reasons. You can see the Open In functionality in Safari when you download a ZIP or PDF and have an app like GoodReader installed. Again, if the other app supports it then you can register your own custom url scheme; some apps allow you to send them commands and/or retrieve data from them that way. Now if you write multiple apps I *think* you can create a shared iCloud storage area that both apps can read/write to, but currently that is restricted to apps under the same developer account. Yes, this is not ideal. Yes, we've filed feature requests. Yes, Apple is aware we'd all like something better here that also preserves the security sandboxing gives you. But no, there is nothing you can do about it right now.


2. You can't do meaningful development for iOS without a Mac. Worst-case, get the previous model Mac mini or something. I believe in VM scenarios you may have trouble actually submitting the app to the store. If you really want, you can do the VM thing as a temporary test or what have you. Also, Macs support VNC just fine, go to Settings, Sharing, and turn on Screen Sharing; poor man's KVM if you want to use that old MacBook for it. Be forewarned, if it's the old non 64-bit MacBook you'll be up a creek because the newer Xcode and OS X require 64-bit and Apple won't accept submissions from really old Xcode versions. That's life under Apple... you're coming into the future even if you have to be dragged against your will.


Now for the unasked question... should you even do this project in Objective-C? It really depends. If you shell out for MonoTouch, you can bring over your C# non-GUI code. If that is a decent amount of code that you'd like to share and/or not re-write, then I would say go for it. Run MonoDevelop on MacOS and go to town. It will integrate with Xcode to let you do the Interface Builder parts by using a pseudo-project and streaming the changes back into the Mono side.

If you'd prefer to list "iOS" developer on your skill set someday, then start learning Objective-C and Xcode. I still recommend the CS-193P Stanford course as a good intro, just skip the assignments and busywork and fast-forward any of the simpler explanations like MVC. For the most part he just assumes you're a reasonably competent developer and dives right in to making UIKit and Interface Builder dance for you. There is such a huge gulf on how Apple and UIKit expect you to approach app design that you'll get lost in a heartbeat if you try to apply any of your Visual Studio knowledge, especially concerning the GUI designer (imagine Visual Studio didn't autogenerate the designer.cs files of forms and you had to both write that code manually and connect the controls to their named properties and events manually - that's closer to how Xcode and Interface Builder work. It sucks, but on the other hand [UIView animate...] blows away anything you can ever do in WinForms/WPF). This is the route I took and I really enjoyed learning a new platform.

There's also a third way, use MonoTouch to create a library to share core code, but write your actual app in Objective-C... last I checked this was still experimental/non-supported so you may be charting new territory if you try it.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
A couple of tidbits about sharing data between apps:

1. Two apps with the same bundle seed (read: made by the same Apple developer account) can pass secure data via the keychain, though it should be limited to small data like login credentials. I've passed some not-exactly-user-credential data between apps, but I didn't have to go through the app store. I have no idea how stringent Apple is about that.
2. Apps can read/write to the same UIPasteboard with an arbitrary name, but so can any other apps.

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
My first app got reviewed and I just needed to set up paid contracts to sell it.



It's still in processing - is this something that is reviewed by a human? Any idea how long I should be expecting for approval?

It's (I hope!) the only hurdle left between me and the App Store.


and thats what we call an impatient post, it's fine

my app is live, buy it if you like saving money on booze! https://itunes.apple.com/gb/app/beerculator/id725585622?ls=1&mt=8

Mr SuperAwesome fucked around with this message at 00:05 on Oct 23, 2013

Dr Monkeysee
Oct 11, 2002

just a fox like a hundred thousand others
Nap Ghost

pokeyman posted:

Finally, there is Xamarin, a decidedly non-free tool for writing iOS apps in C# with a lot of the .NET stuff included. Actually I'm not sure you need Xcode for that, but I'm guessing you will.

I believe you can do all your development in Xamarin Studio but it requires Xcode to be installed for some shared functionality (probably the interface builder integration among other things) and you definitely need Xcode to sign the app for publish.

lord funk
Feb 16, 2004

Anyone else using Server in Mavericks to host their projects? I was just curious what steps are good to take for security, i.e., how not to have my code exposed to the world.

Toady
Jan 12, 2009

I'm using the new JavaScriptCore API to expose some Objective-C classes. I want to determine what kind of object it is in JavaScript, but instanceof is evaluating to false. I'm inexperienced with JavaScript, and I don't know if the API doesn't support this usage.

code:
// Objective-C
JSContext *context = ...;
context[@"Foo"] = [Foo class];
context[@"foo"] = [[Foo alloc] init];

// JavaScript
if (foo instanceof Foo)
    Log("true");

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
Does anyone have any experience integrating Google Analytics into their app?

I'd like to track data the user enters in and aggregate it so I can refine my user interface to match the user's entered data better.

I've got the boilerplate code set up but I can't quite figure out how to get it to track actual data and stuff. I am dumb but google's documentation is also confusing as heck

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Toady posted:

I'm using the new JavaScriptCore API to expose some Objective-C classes. I want to determine what kind of object it is in JavaScript, but instanceof is evaluating to false. I'm inexperienced with JavaScript, and I don't know if the API doesn't support this usage.

code:
// Objective-C
JSContext *context = ...;
context[@"Foo"] = [Foo class];
context[@"foo"] = [[Foo alloc] init];

// JavaScript
if (foo instanceof Foo)
    Log("true");

Try outputting
pre:
Object.getPrototypeOf(foo)
- it's probably a wrapped object or a proxy or something.

See Mozilla docs

Toady
Jan 12, 2009

Carthag posted:

Try outputting
pre:
Object.getPrototypeOf(foo)
- it's probably a wrapped object or a proxy or something.

See Mozilla docs

I thought it would work based on my reading of JSExport.h. Object.getPrototypeOf(foo) === Foo.prototype evaluates to true, yet foo instanceof Foo doesn't.

NoDamage
Dec 2, 2000

Mr SuperAwesome posted:

Does anyone have any experience integrating Google Analytics into their app?

I'd like to track data the user enters in and aggregate it so I can refine my user interface to match the user's entered data better.

I've got the boilerplate code set up but I can't quite figure out how to get it to track actual data and stuff. I am dumb but google's documentation is also confusing as heck
I just tried integrating Google Analytics today and found it similarly confusing. The only thing I want to do is track the number of daily active users, version of the app they have installed, and their iOS version. I found the docs really confusing, they seem oriented towards adding 'screen tracking' (kind of like page hits on the web), but I don't have any interest in that. It also seems very shoehorned in from their web analytics.

I can't figure out whether or not the default configuration of Google Analytics records the app version and iOS version, or whether or not those need to be specially recorded with some kind of custom tracker.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Toady posted:

I thought it would work based on my reading of JSExport.h. Object.getPrototypeOf(foo) === Foo.prototype evaluates to true, yet foo instanceof Foo doesn't.

log the values and post them here

HiriseSoftware
Dec 3, 2004

Two tips for the wise:
1. Buy an AK-97 assault rifle.
2. If there's someone hanging around your neighborhood you don't know, shoot him.
This "iCloud Keychain" thing, do I have to do anything differently when saving data using the keychain API to make it work with iCloud? Googling doesn't seem to be helping me answer that question.

Edit: vvvvv No wonder I couldn't find anything. Thanks!

HiriseSoftware fucked around with this message at 17:44 on Oct 23, 2013

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
iCloud keychain is Safari-only.

Toady
Jan 12, 2009

Carthag posted:

log the values and post them here

"[object FooPrototype]" for both.

Doh004
Apr 22, 2007

Mmmmm Donuts...
Anyone run into issues submitting their apps via XCode 5 and getting them to validate? I'm getting these errors:

"Invalid Image Path - No Image found at the path referenced under key 'CFBundleIcons': 'Icon-60.png'" (3 total of these, also for Icon-20 and Icon-30.

Those were old app icons that we used that are no longer in use? I used the image picker thing for the target and they all look correct, so I'm a bit confused. I also made sure to check my .plist file for the CFBundleIcons items and neither of those "icon" files are referenced anymore.

Am I missing something obvious here?

*edit* found it. Turns out there are two dictionaries in the plist file for app icons? Who knows, now I know to do a cmd+f in the plist file to save myself trouble.

Doh004 fucked around with this message at 15:34 on Oct 24, 2013

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Doh004 posted:

*edit* found it. Turns out there are two dictionaries in the plist file for app icons? Who knows, now I know to do a cmd+f in the plist file to save myself trouble.

Yep, they moved around a couple times. I think at the very start you just had to name them a particular way? After that you could specify filenames in Info.plist. And now they've moved to Asset Catalogs, out of Info.plist entirely.

NoDamage
Dec 2, 2000
Is there a canonical example of the proper way to adjust a UIScrollView/UITableView/UITextView to account for the keyboard appearing? Most of the answers I've seen on StackOverflow seem to miss several use cases (examples: when the scroll view is displayed inside a form sheet on the iPad, or when the relevant controller is inside a UINavigationController with navigation controller's toolbar showing.)

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

NoDamage posted:

Is there a canonical example of the proper way to adjust a UIScrollView/UITableView/UITextView to account for the keyboard appearing? Most of the answers I've seen on StackOverflow seem to miss several use cases (examples: when the scroll view is displayed inside a form sheet on the iPad, or when the relevant controller is inside a UINavigationController with navigation controller's toolbar showing.)

I couldn't find one last week.

This is what I came up with when dicking with text views. I ran into the same thing, everyone had their own slightly different way to go about it. I haven't tested that code thoroughly, so I guess it's yet another take. Either way I can't claim it's canonical.

The main parts that people seem to gently caress up are dealing with the interface orientation (notification's keyboard frame is in screen coordinates, just translate to window coordinates) and adjusting the contentInset (as opposed to changing the view's frame or, worse, embedding the scroll view in another scroll view).

It's code that sits in a weird nether region between obviously boilerplate code and requiring more customization than Objective-C can easily deliver.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Toady posted:

"[object FooPrototype]" for both.

That's odd. I guess there's some behind the scenes fuckery going on... No idea what though.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Free copy of OS X Server in the iOS Dev Center.

Just in case anybody didn't read that email very closely.

Glimm
Jul 27, 2005

Time is only gonna pass you by

NoDamage posted:

Is there a canonical example of the proper way to adjust a UIScrollView/UITableView/UITextView to account for the keyboard appearing? Most of the answers I've seen on StackOverflow seem to miss several use cases (examples: when the scroll view is displayed inside a form sheet on the iPad, or when the relevant controller is inside a UINavigationController with navigation controller's toolbar showing.)

I'm not sure if this hits your corner cases but I've used this in the past:

https://github.com/michaeltyson/TPKeyboardAvoiding

Adbot
ADBOT LOVES YOU

lord funk
Feb 16, 2004

Stupid question: is Xcode optimized for OpenCL? i.e. - will the new Trashmac be an absolute monster with its dual-GPUs?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply