Skip to content

Instantly share code, notes, and snippets.

@xandrucea
Last active December 18, 2015 23:29
Show Gist options
  • Save xandrucea/5862144 to your computer and use it in GitHub Desktop.
Save xandrucea/5862144 to your computer and use it in GitHub Desktop.
Using different methods for seeding srand()
from post: http://stackoverflow.com/a/6864328/1141395
time of the day, returns number of seconds elapsed since midnight January 1st, 1970
-----------------------------------------------------------------------------------
time(NULL);
$(ARCHS_STANDARD_INCLUDING_64_BIT)
where to find xCode Snippets
----------------------------
~/Library/Developer/Xcode/UserData/CodeSnippets/
ternary operator
----------------
NSString *result = (condition ? @"condition is true" : @"condition is false");
using transporter
-----------------
/usr/local/itms/bin
$ iTMSTransporter -m lookupMetadata -u [iTunes Connect username] -p [iTunes Connect password] -vendor_id [App SKU] -
destination [destination path for App Store Package]
$ iTMSTransporter -m verify -f [path to App Store Package] -u
[iTunes Connect user name] -p [iTunes Connect password]
$ iTMSTransporter -m upload -f [path to App Store Package] -u
[iTunes Connect user name] -p [iTunes Connect password]
insert font
-----------
add new font into "...-Info.plist"
--> Fonts provided by application, Item 0 ---> font name
add font name to prefix.pch
#define kFont @"[fontName]"
change bundle identifier
------------------------
Info --> Bundle identifier --> change name
cpu timestamp
--------------
rdtsc();
formatting code
---------------
#pragma mark - [section description]
// TODO: trim white spaces
Valid Architectures
-------------------
i386, x86_64
placeholders for formatting or logging (NSLog)
----------------------------------------------
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html
create a new version out of an existinc app
-------------------------------------------
- click on project and duplicate the existing target by right clicking
- rename it without spaces
- change the bundle identifier
- change version and build version numbers
- inside code the target can be identified by comparing the bundleidentifier
if([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:kMyBundleIdentifier]){
[self doSomething];
}
For the new version, a new AppID has to be created as well as certificates if push is used.
in app products
---------------
1. App id anlegen (s. weiter unten)
2. Log into iTunes Connect (https://itunesconnect.apple.com/)
3. Select Manage Your Apps
4. Add App
5. SKU ----> rand()
6. Tier 2, No Education, No B2B
7. Copyright: Firmenname
8. lalalalala
after creating the new app:
- Manage In-App Purchases
- Reference Name: Name of Product
- Product ID: ID from Prefix.pch in xCode
- Add Language
- Hosting with Apple: NO
- Upload Screenshot with Buy button
- save
creating profisioning profile
-----------------------------
1. Create new App ID in Member Center
- Name: AnyName
- Prefix: AnyPrefix
- BundleId: [com.BLochmann.]aName
2. select
- Game Center
- InAppPurchase
- PushNotification
3. Save
4. Schlüsselverwaltungöffnen
- Zertifikatsassistent / Ein Zertifikat anfordern...
- E-Mail eintragen und auf Festplatte speichern
- Eigenen privaten Schlüssel exportieren
5. App ID öffnen und angefordertes Zertifikat hochladen
6. Generiertes Zertifikat herunterladen (Dev und Dis)
7. die heruntergeladenen Zertifikate und privaten Schlüssel
mit Hilfe des Skripts verknüpfen (sicheres Passwort)
.././makePem.sh aps_development.cer ../[p12-file-name].p12 CertNameDev
8. Beide PEM verschicken
create provisioning profile
---------------------------
1. Add iOS Provisioning Profile
2. Select App ID
3. Entwickler auswählen
4. Alle Geräte auswählen
5. Name eingeben und markieren ob _Dev oder _Dis
// Porduktiv wird von demjenigen erstellt der es hochlädt
add strings to clipboard
------------------------
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = @"paste me somewhere";
call method with delay
----------------------
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1.5 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
// call method here
});
creating xCode code shortcuts
-----------------------------
1. drag code snippet into shortcuts
2. to create placeholder: <#[placeholdername]#>
disable ARC for specific classes/files
--------------------------------------
1. Open Build Phases of the Project
2. Select files inside Compile Sources
3. add Compile Flag "-fno-objc-arc"
localization
------------
1. change strings from ...stringWithFormat:@"anystrings %@", var];
to stringWithFormat:NSLocalizedString(@"anystrings %@), var];
2. create new dir inside project folder
mkdir localization
3. insert all strings from .m
find . -name \*.m | xargs genstrings -o localization/localization.lproj
more specific: http://stackoverflow.com/questions/637467/grouping-predicates-in-find
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment